form submit

HTML submit button onclick code

An HTML button is created using the following HTML code: <input type='submit' name="submit" value="Post Form" /> Or using the button tag like this: <button type="submit" >Post the form</button> In both the cases, pressing the button will submit the parent form without the need for handling the onclick event separately. If you want to validate the form before submitting, the best event handler would be the onsubmit event of the form. Example:

Continue Reading →

How to create a multi-submit form

Imagine you have a form that needs to be processed by different scripts based on user's input. (example: ‘update’ or ‘create new’) . You can use JavaScript to switch the action field of the form just when the submit button is pressed. See the page below for some examples: Switching the form's ‘action’ field dynamically What we will try to do in this post is still more adventurous: submitting the same form to multiple scripts at the same time!

Continue Reading →