I have a form which consists of at least one line.
Each line of the form includes the numeric variables qty, rate and VAT and a text variable called description.
When the form is first presented to the user it has values in each form element. What I am trying to do is restore the original numeric value in any of the numeric form elements if a non-numeric value has been entered. This I have failed miserably to do. I can save the original numeric value and I can tell which form element I have just come out of but I can't as yet write that stored value back when necessary.
I have attached the bones of my script.
Expand|Select|Wrap|Line Numbers
- function SumLine (form, line, focusWhere) {
- newValue = tdp(focusWhere.value);
- if ( isNaN(newValue) == true) {
- alert ("Different types!" + storedValue + focusWhere.name);
- form.focusWhere.name = storedValue;
- }
I can use element[] if I could work out the numer of the particular element. Bear in mind that that the form can have one or more lines and so can be of different lengths at different times.