|
| detecting change on a hidden field |
 |
Tue, 25 Mar 2008 12:19:14 -050 |
I have had to use work arounds when it comes to dealing with hidden fields.
The problem is this, you cannot get the "onChange" or any other event
handler to fire on a hidden field when the change occurs as a result of a
script. I have tried to select and more. Is there a way to build an
automatic trigger?
you can test the sample below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function test() {
alert('test');
}
function startUp() {
//test();
document.getElementById('x').select();
document.getElementById("x").value = "1";
document.getElementById('thisButton').select();
alert("this is the value of x " +
document.getElementById("x").value +
"\n You should have seen another alert before this one!");
}
//-->
</SCRIPT></HEAD>
<BODY>
<FORM >
<INPUT
TYPE="hidden"
NAME="x"
id="x"
onSelect="test();"
onChange="test();"
onblur="test();">
<INPUT
TYPE="button"
name="thisButton"
id="thisButton"
value="go"
onClick="startUp();">
</FORM>
</BODY>
</HTML>
|
| Post Reply
|
| Re: detecting change on a hidden field |
 |
Tue, 1 Apr 2008 08:14:36 -0500 |
They don't fire if the fields not hidden either. You have to invoke them.
myField.value := "something"
myField.onChange()
Rick
"Claus Mygind" <cmygind@tsccorp.com> wrote in message
news:Edd5g5pjIHA.316@news-server...
>I have had to use work arounds when it comes to dealing with hidden fields.
>The problem is this, you cannot get the "onChange" or any other
event
>handler to fire on a hidden field when the change occurs as a result of a
>script. I have tried to select and more. Is there a way to build an
>automatic trigger?
>
> you can test the sample below:
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
> <HTML>
> <HEAD>
> <SCRIPT LANGUAGE="JavaScript1.2">
> <!--
> function test() {
> alert('test');
> }
> function startUp() {
> //test();
> document.getElementById('x').select();
> document.getElementById("x").value = "1";
> document.getElementById('thisButton').select();
>
> alert("this is the value of x " +
> document.getElementById("x").value +
> "\n You should have seen another alert before this one!");
> }
> //-->
> </SCRIPT></HEAD>
>
> <BODY>
> <FORM >
> <INPUT
> TYPE="hidden"
> NAME="x"
> id="x"
> onSelect="test();"
> onChange="test();"
> onblur="test();">
> <INPUT
> TYPE="button"
> name="thisButton"
> id="thisButton"
> value="go"
> onClick="startUp();">
> </FORM>
> </BODY>
> </HTML>
>
>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|