[Javascript] action="insert"

Michael Borchers list at tridemail.de
Fri Feb 10 07:09:27 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.

i just wondered if there is any "official js rule" that should forbid a 
input tag named action too
since the form tag includes this. i will also check my script again that 
those days didn't seem to work.

let me tell you the reason i wrote it:
indeed my navigation works with several submit buttons and works well.
i use php to read out the "pushed" button f.e. "insert" and then decide what 
to do.

it's no problem and a good solution, but here comes the funny thing:
regarding only one submit button named whatever firefox accepts both, mouse 
klick and pressing return,
but IE does only accept the mouse klick 8-( 




More information about the Javascript mailing list