You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2004/03/15 07:28:37 UTC

Submitting a form using a button from outside the form

For various reasons I need to submit a form from a button that's outside of 
the form itself.  Using a bit of javascript it isn't too hard to submit the 
form but there's one issue: I would like to be able to know which button is 
being pressed.  Normally I can use the tag stuff to do this but since this 
is done using javascript voodoo magic I don't have this option available.

Is there any way I can simulate this functionality using Javascript?

Regards,


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Submitting a form using a button from outside the form

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

You can create a Hidden field in the Form, and fill it in using JavaScript
with an id specified by the button when it is pressed. When the form
submits, the hidden field will pass that value to the server and you can
check it to determine which button has been pressed.

Basically, something like this (off the top of my head -- may contain
errors)
hidden.value = "SideButton2"; form.submit();

Keep in mind that Hidden encodes its values by default, so to set it to a
string, either prepend the string with 'S' or set the 'encode' parameter to
false. I personally prefer the latter approach -- it is cleaner and more
robust.

-mb

----- Original Message ----- 
From: "Glen Stampoultzis" <gs...@iinet.net.au>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, March 15, 2004 8:28 AM
Subject: Submitting a form using a button from outside the form


>
> For various reasons I need to submit a form from a button that's outside
of
> the form itself.  Using a bit of javascript it isn't too hard to submit
the
> form but there's one issue: I would like to be able to know which button
is
> being pressed.  Normally I can use the tag stuff to do this but since this
> is done using javascript voodoo magic I don't have this option available.
>
> Is there any way I can simulate this functionality using Javascript?
>
> Regards,
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org