I have a form with onchange events set on some of the text fields so that calculations can be made. By clicking the Submit button, the form data is then saved to the database. This all works fine as long as you leave a text field by tabbing to or clicking in another field before clicking Submit. However if you make a change in a text field and then directly click the Submit button, the onchange event occurs but the form submission does not. I have tried other types of events such as onfocus, onblur, etc. in place of onchange. I have also tried using the setTimeout function, with various time values, to cause a delay between the onchange and submit events. But the results are the same. Any advice would be appreciated. Thanks.
The form tag looks like
<form id='inv_form' name='inv_form' method='post' action='new_inv.php' onsubmit=’return checkform( this )’>
The onchange events on the form's text boxes look like
Upon onchange and onsubmit, the script calls itself (new_indv.php). In the case that the submit button is clicked, the data validation script 'checkform' should run prior. In new_indv.php, I check to see if the submit button, named submit1, has a value which indicates it was clicked. If it does, the script save_inv.php is called to save the final data to the database. If the submit button was not clicked, it was an onchange event and the new_indv.php script continues with running calculations and populating the form.
These events happen as they should if they occur separate from each other. But if you change a text box and directly click the submit button (without tabbing or clicking another field first), the onchange occurs but the final form submission does not.