CheeserTheAverage
asked on
When submitting a form using OnChange how can I pass a variable to determine if the submit button was clicked or the option field was changeed?
My current script submits the form if a certain option field is changed. The form is submitted back to the same page for processing with PHP. The problem is that this triggers my form validation code, and puts a message on the screen prompting the user to correct those errors.
I need to be able to tell if the submit button was pressed, or if 'onchange' submitted the form so that the program logic can decide whether or not to validate the data. How can I do this?
I need to be able to tell if the submit button was pressed, or if 'onchange' submitted the form so that the program logic can decide whether or not to validate the data. How can I do this?
<form id="invoiceInput" name="invoiceInput" method="POST" action="<?php echo $editFormAction; ?>">
<select name="invoiceMonth" id="invoiceMonth" onChange="JavaScript:form.submit()">
<option value=""> </option>
<option value="months">Months</option>
</select>
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.