wood burning stoves 2.0*
The moose likes JSP and the fly likes How to determine which button/menu cause a submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to determine which button/menu cause a submit" Watch "How to determine which button/menu cause a submit" New topic
Author

How to determine which button/menu cause a submit

Fritz Largosa
Ranch Hand

Joined: Sep 12, 2005
Posts: 70
I have two menus which autosubmits a form whenever the user selects an item. I want an if statement which determines which menu submited the form. I do now know how to implement this one though. If you know some way to do this please let me know. Thanks...


--------------------------------------------------------
<select name="Menu1" onchange ="document.form3.submit()">
<%
if(request.getParameter("select2").equals("2")){
out.println(" <option>2</option> <option>1</option>");

}//if
else{
out.println(" <option>1</option> <option>2</option>");
}//else

%>

</select>

<select name="Menu2" onchange ="document.form3.submit()">

</select>

--problem code below. I do now know how to implement the code below--
<%
if(Menu1 submited the form)
do this

if(Menu2 submited the form)
do this

%>
Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
Use a hidden input type to determine who submits...



SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to determine which button/menu cause a submit
 
Similar Threads
howto make html:link dynamic select item of map ?
content of dropdown B will depend on what is selected on dropdown A
ValuechangeListener does not change the value
Null vs empty string
How to submit through a dropdown menu.