Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Three Submit buttons in the same row? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Three Submit buttons in the same row?" Watch "Three Submit buttons in the same row?" New topic
Author

Three Submit buttons in the same row?

vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Hi guys,
I m invoking a servlet thro HTML submit button that outputs the detailed Reg form.It has three "submit" buttons in the end.Each has different action.I wish to place them in the same row of the table.How do I achieve this?
As far as I know there can be only one action.Shall I take three diff tables(1 row 1 column) having three forms resp. each having diff action.Right now they are placed one below the other.
Three common buttons are "submit" "back" and "cancel".


VAIBHAV <BR>SCJP
Ramneek Handa
Ranch Hand

Joined: Nov 10, 2000
Posts: 44
Hi vaibhav,
Just place the simple buttons instead of the submit buttons. Just call a function on onClick event of the button and pass the parameter 1,2 or 3 as action so that you can know which button is got pressed.
In the common function you can check which button got pressed and depending on that you can change the action and submit the form i.e
document.[formname].action="URL";
document.[formname].submit();
hope this will solve your problem.
bye.
vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Thanks Ramneek,
I got your point,that means I ll have to use Javascript.
Melissa Jeidi
Greenhorn

Joined: Jan 19, 2001
Posts: 3
couldnt you just have them all as submit buttons (only one will get pressed at a time.) and then check on the receiving page which one was pressed and do that action. then you dont need javascript.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Please do not post the same message in multiple forums.
Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
I would not recommend this, since there is no real need for using JavaScript here and it limits the clients that can use your page. Simply use three submit buttons with different name attributes (i.e. '...name="cancel"', '...name="update"', ...) and check for the existence of these names in your processing JSP or Servlet.
The other part of your question seems to be more of an HTML issue. I am not an expert on this myself, but it sounds like using a table row with three cells, one for each submit button, should work.
-Mirko
Originally posted by vaibhav punekar:
Thanks Ramneek,
I got your point,that means I ll have to use Javascript.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Three Submit buttons in the same row?