tags:

views:

18

answers:

1

Hi, i have one text box in which the text inside the text box should not be deleted and after the text only the cursor has to be placed

Ex: For the textbox: "http://" should be available and the text which is in quotations cannot be deleted inside the textbox and the cursor should be after the quotations.

Thanks in advance, Vara Prasad.M

+2  A: 

add this to the input field:

onchange="testEdit(this)"

and have a javascript function that does something like this:

function testEdit(field) {
  if (field.value.substring(0, 8) != "http://") {
    field.value = "http://" + field.value.substring(8);
  }
}

However, this is sloppy. The best way is to put the http:// in a label OUTSIDE the text box. If something is in a text box, it should be input. By putting that inside the text box, you will be confusing your users.

Good luck.

DexterW
yes if we keep inside the textbox it is little bit confusing ,ThanQ for ur reply
Vara Prasad.M
If i am having the server control then how can i achieve this scenario..
Vara Prasad.M