"surf_doggie" <earl.robb@gmail.comwrites:
I have a form that has 3 input type="text" fields. The fields are
Quantity, Amount and total. OnKeyUp is used when you enter something in
Quantity or Amount to trigger a javaScript function that makes a
calculation and updates the total field.
>
The total field is "locked" with onFocus=this.blur so that the totals
cannot be entered by the end user. I did not use disable because when
the form is submitted I had problems with asp form collection of
disabled form elements.
What is the oldest browser you're trying to support? You can simply
disable an input control with disabled="disabled" in the HTML or with
control.disabled=true in JS. Also, as pcx suggested, why not use a div
to display the result of your calculation?
Issue:
1. If you highlight the number you entered for Amount in the form field
then left click and drag it will (copy/cut depending on browser and
version) the Amount field into the "locked" total field.
You can disable drag and drop in IE by handling two non-standard
events, ondragover and ondrop. In FF, to the best of my knowledge, you
can't override default DnD behaviors unless you use XUL to describe at
least part of your document.
In any case, I have a feeling that you don't need to deal with DnD as
such, just as long as the element you use to display your results is
not an input or is disabled.
2. If you click drag as described above the Amount into the next Amount
field the total will not be calculated because a key event was not used
to move the data thus the javaScript function to do the calculation was
not fired.
Are you using onkeyup? Try onchange.
Ari.
--
Elections only count as free and trials as fair if you can lose money
betting on the outcome.