Skip to content Skip to sidebar Skip to footer

Jquery, Changing Form Action

i cannot seem to find the answer to this. i uploaded code to pastebin (so wouldnt clutter up the post): http://pastebin.com/BhnNTnJM but the action only changes for the delete form

Solution 1:

You have an input field called action in the form-horse-update and form-horse-add forms. e.g.

<inputtype="hidden" name="action" value="add" />

action is kind of a reserved word, as having an input field with that name changes the behaviour of the form. Normally in JavaScript (let alone jQuery) a reference to something like:

document.myform.action

refers to the action attribute of the form. The minute you add an input field called action then instead the above would refer to the input element called action and there is no longer a way to access the form's action attribute.

The best solution is to rename your action input fields to something else (but probably best not to rename it to submit! ;) )

Post a Comment for "Jquery, Changing Form Action"