Set a form's action attribute when submitting?

dave picture dave · Apr 12, 2011 · Viewed 107.7k times · Source

How do I change a form's action attribute right after clicking the submit button?

Answer

James picture James · Apr 12, 2011
<input type='submit' value='Submit' onclick='this.form.action="somethingelse";' />

Or you can modify it from outside the form, with javascript the normal way:

 document.getElementById('form_id').action = 'somethingelse';