Husain wrote:
I am new to Javascript and JSP. I would like to have multiple submit
buttons in a form. Each button has a different action?
No, that is not possible. You need to have different forms for different
form actions. However, the server-side resource to receive the form data
as referred to by one form element's `action' attribute can differentiate
between the action to be performed according to the used submit button.
How can I go about doing that? How can I obtain the button's name or id?
Only the activated submit button is included in the list of successful
controls. So you could use the same name and evaluate the different value
server-side. However, it becomes more difficult with automated i18n.
Another approach is to use a different control name for each submit button.
Since only the activated submit button is considered a successful one, you
only get its name in the request and not the names of the other buttons.
This has nothing to do with "Javascript", nor should client-side scripting
be used to resolve it (unless further client-side actions are necessary on
submit.)
BTW, JSP is JavaServer Pages (not JavaScript Pages), which is therefore
off-topic here and on-topic in comp.lang.java.*. Java != JavaScript.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16