events without user input
hi,
i'm having the exact same problem as this person and haven't been able to find a solution. bascially, we have some code that is changing the text in a text field, and i need my script to detect when that text changes, and do something with it. the user never directly interacts with the changed field, so none of the traditional events will fire. is there anyway to detect that the text field has changed programatically, without user input? a really simple example might be something like this:
function1(){document.form.box2.value = document.form.box1.value + 1;}
function2(){document.form.box3.value = document.form.box2.value + 1;}
<form name="form">
<input type="text" name="box1" onBlur="function1()">
<input type="text" name="box2" onChange="function2()"> //this won't work automatically
<input type="text" name="box3">
</form>
so the user can input "5" i the first box and instantly get "6" in the second and "7" in the third.
i know that code is Bad and that there are 1,000,000 simple ways to accomplish what i'm asking without doing what i'm asking for, but in my case, those ways aren't possible. i need specifically something to notice, "oh, the contents of box2 have changed! time to do function2!" without any user interaction with box2.
i'm having the exact same problem as this person and haven't been able to find a solution. bascially, we have some code that is changing the text in a text field, and i need my script to detect when that text changes, and do something with it. the user never directly interacts with the changed field, so none of the traditional events will fire. is there anyway to detect that the text field has changed programatically, without user input? a really simple example might be something like this:
function1(){document.form.box2.value = document.form.box1.value + 1;}
function2(){document.form.box3.value = document.form.box2.value + 1;}
<form name="form">
<input type="text" name="box1" onBlur="function1()">
<input type="text" name="box2" onChange="function2()"> //this won't work automatically
<input type="text" name="box3">
</form>
so the user can input "5" i the first box and instantly get "6" in the second and "7" in the third.
i know that code is Bad and that there are 1,000,000 simple ways to accomplish what i'm asking without doing what i'm asking for, but in my case, those ways aren't possible. i need specifically something to notice, "oh, the contents of box2 have changed! time to do function2!" without any user interaction with box2.
