From: bill on
I have a form that is loaded into a div with AJAX. The .js is in
the main program.

The form contains:
<td style="border-bottom: 1px solid blue" >
$ <input type="text" size="8" maxlength="8" name="amount1"
id="amount1" onchange="PmtRecalc(this,2)">
</td>

The problem is that the onchange does not fire until I click in
another input box or outside of the div; it does not fire when
the value changes or if I click on a non-input section of the div.

onblur works exactly the same way.

On the same form, not loaded by AJAX, the onchange handler fires
when I click anywhere on the form outside of that input box.

I would like to restore the prior behavior, any suggestions ?

bill
From: David Mark on
bill wrote:
> I have a form that is loaded into a div with AJAX.

Ajax.

> The .js is in the
> main program.

JS (or Javascript).

>
> The form contains:
> <td style="border-bottom: 1px solid blue" >
> $ <input type="text" size="8" maxlength="8" name="amount1"
> id="amount1" onchange="PmtRecalc(this,2)">
> </td>

It's beside the point, but downloading and appending a table seems like
an odd choice. Same goes for event handler attributes (not to mention
inline styles). You should attach the listener after appending the form
as I assume the script with the "PmtRecalc" function is referenced by
the containing document. That way if you ever have to change the
listener name or signature, you won't have to hunt down and change
additional HTML snippets. Furthermore, as written, there is no recourse
if the required function is unavailable for some reason (e.g. the script
didn't download, required features were absent, etc.)

>
> The problem is that the onchange does not fire until I click in another
> input box or outside of the div; it does not fire when the value changes
> or if I click on a non-input section of the div.

The change event does not need to fire until the control has lost focus.
AFAIK, IE has always implemented it that way, which is perfectly
acceptable per the specifications (not "slow" as per your subject line).

As for not firing on clicking a "non-input" section of the div, does the
input not lose focus on that operation? ISTM that it should, but I
can't see what else you are doing in your script.

>
> onblur works exactly the same way.

Which tells me that the control is not losing focus for some reason.

>
> On the same form, not loaded by AJAX, the onchange handler fires when I
> click anywhere on the form outside of that input box.

As it should when the control loses focus.

>
> I would like to restore the prior behavior, any suggestions ?

You should post an example page or at least specify the browser in use.

>
> bill

Hey! Do you work on Dojo? :)
From: Thomas 'PointedEars' Lahn on
David Mark wrote:

> bill wrote:
>> I have a form that is loaded into a div with AJAX.
>
> Ajax.

IBTD.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: David Mark on
Thomas 'PointedEars' Lahn wrote:
> David Mark wrote:
>
>> bill wrote:
>>> I have a form that is loaded into a div with AJAX.
>> Ajax.
>
> IBTD.

Ibtd. :)