[Javascript] action="insert"

David Dorward david at dorward.me.uk
Fri Feb 10 04:16:06 CST 2006


On Fri, Feb 10, 2006 at 11:08:47AM +0100, Michael Borchers wrote:
>    i know some people like navigation their sites by using an "action" f.e.
>    parsed via form
>    <input type="hidden" name="action" value="...">...
>     
>    i once used 2 submit buttons that on click changed the value of the
>    "action" hidden field, f.e. "insert" or "delete".

You don't need JavaScript for this.

<input type="submit" name="action" value="Insert">
<input type="submit" name="action" value="Delete">

Only the successful (i.e. clicked upon) control is submitted.

>    it didn't work until i decided to rename the button f.e. into "subaction".
>     
>    I guess that "action" is already covered by the <form action="..."> tag,
>    right?!

You haven't shown us your JavaScript code, but
document.form['formId'].elements['action'] should work fine. Although,
as I said, you don't need to do this.

-- 
David Dorward                                      http://dorward.me.uk




More information about the Javascript mailing list