S
Senthil
Hi,
This might have already been discussed, but i couldn't find any when
i tried to search for it in the groups.
I'm having some problems while trying to change the value of a
textbox programatically in Javascript.
Consider the foll scenario:
Say i have a textbox with onChange event defined in a form. When the
form is displayed to the user, he/she enters the value "abc" into the
textbox. The onChange event would be called. Say, in the onChange
event handler, i change the textbox value programmatically to some
other string (say "cde").
textbox.value = "cde";
The textbox also gets reflected with the new string ("cde" in this
case).
i.e. The textbox shows "cde".
I know that changing the textbox value inside the program does not
trigger the onChange event. That said, now, the user clicks on the
textbox and changes the value to "abc" again. But after changing that,
when the user looses focus (by clicking outside), the onChange event
handler is not getting called. Ideally, I would expect the event to
have triggered for the textbox value is changed from "cde" to "abc".
But its not happening.
I suspect that the onchange event is not comparing the new value
("abc" in this case) with the one changed inside the program ("cde" in
this case).
Can anyone pls let me know how i cud trigger the onChange event, in
this case.
Is this,
textbox.value = "cde";
alone sufficient to change the value of a textbox, or do i need to do
anything else too, for the onchange to pick up the new value.
Is this problem got to do anything with the browser caching stuffs?
Just for reference, the browser I'm using is Internet Explorer.
Thanks in advance.
~Senthil
This might have already been discussed, but i couldn't find any when
i tried to search for it in the groups.
I'm having some problems while trying to change the value of a
textbox programatically in Javascript.
Consider the foll scenario:
Say i have a textbox with onChange event defined in a form. When the
form is displayed to the user, he/she enters the value "abc" into the
textbox. The onChange event would be called. Say, in the onChange
event handler, i change the textbox value programmatically to some
other string (say "cde").
textbox.value = "cde";
The textbox also gets reflected with the new string ("cde" in this
case).
i.e. The textbox shows "cde".
I know that changing the textbox value inside the program does not
trigger the onChange event. That said, now, the user clicks on the
textbox and changes the value to "abc" again. But after changing that,
when the user looses focus (by clicking outside), the onChange event
handler is not getting called. Ideally, I would expect the event to
have triggered for the textbox value is changed from "cde" to "abc".
But its not happening.
I suspect that the onchange event is not comparing the new value
("abc" in this case) with the one changed inside the program ("cde" in
this case).
Can anyone pls let me know how i cud trigger the onChange event, in
this case.
Is this,
textbox.value = "cde";
alone sufficient to change the value of a textbox, or do i need to do
anything else too, for the onchange to pick up the new value.
Is this problem got to do anything with the browser caching stuffs?
Just for reference, the browser I'm using is Internet Explorer.
Thanks in advance.
~Senthil