Click to See Complete Forum and Search --> : multiple fields greater then 0


wheels995
06-08-2006, 07:42 AM
I have a few fields that I need to check for a greater than zero input on submit.

fields:
$602200
$602201
$602202

I need to check $602200 if it is greater than 0 then stop and submit form. If it is less then 0 then go to $602201. Do the same for $602201 and $602202. If at the end of the fields none are greater than 0 then error.

I do not want to just check all fields as there are other fields on this form that require information that has nothing to do with the info in the above fields.

I am new to JS so any direction on this would be greatly appreciated. Thank you

Charles
06-08-2006, 07:44 AM
I'm not exactly clear about your meaning. Please elaborate.

wheels995
06-08-2006, 08:15 AM
Basicly I need a function that is called when I submit the form that will check 3 or more specific fields one at a time. When it checks the first field it looks to see if it is greater than 0. If it is greater than zero it stops the function and submits the form. If it is not greater then 0 it goes to the next field and does the same thing. If at the end of checking all the fields none are greater than 0 then error to inform user nothing was entered and go back to the form.

I do not want this to just check all the feilds on the form as there are others on this form that have nothing to do with the fields I need to check.

Thank you

Charles
06-08-2006, 08:20 AM
<form action="some-script.pl" onsubmit="return (this.firstField.value > 0) || (this.secondField.value > 0) || this.thirdField.value > 0)">