[Javascript] Can this be done?

Hassan Schroeder hassan at webtuitive.com
Thu Oct 30 09:46:04 CST 2003


Roland Dong wrote:

> Is it possible to use one form and one action but send a flag to indicate if
> it should action A or action B?  So I want clicking on button A to pass flag
> value "0" to update.jsp and clicking on button B to pass flag value "1" to
> update.jsp, so that update.jsp will know what action to take.

No need for a flag; two submit buttons with separate names and
values, as in:

<form method="get" action="whatever.jsp">
   <input type="text" name="foo" value="bar"/>

   <input type="submit" value="Do A" name="submissionChoiceA">
   <input type="submit" value="Do B" name="submissionChoiceB">

</form>

The clicked button value will be one of the passed parameters.

No JavaScript required...

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.






More information about the Javascript mailing list