• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Button Tag

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form with several buttons..I am using the button tag rather than the input tag so I can play around with fonts. the problem is the results I get from the request object are not what I would expect.
Here's the form
<form name="oiscr" id = "oiscr" method="post" action="nxpresult.jsp">
<table width="85%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><button name="OK" type="submit" value=""> <b>Ok</b> </button></td>
<td><button name="Ignore" type="submit" value=""><b>Ignore</b></button></td>
</tr>
</table>
</form>
The target jsp has the following code:
<%! String buttonpushed = new String(); %>
<% buttonpushed = request.getParameter("OK"); %>
ok = <%=buttonpushed%>

<% buttonpushed = request.getParameter("Ignore"); %>
ignore = <%=buttonpushed %>
In the Receiving JSP I would expect the value of the Ignore button to be null if I click on the OK...however the result I get is:
ok = Ok Suspend = Suspend
When I define the buttons as input type="submit".... the buttons not pushed are return a null from the request object (as I would expect)
but then I can't change the font unless use the button tag.
Hope someone can see some glaring error, or give me a way to use multiple button tags on a form....
thanks,
Scott
 
scott dawson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This line
ok = Ok Suspend = Suspend
should be
ok = Ok Ignore = Ignore
The problem & result are the same, but I was a bit careless in my entering
data on the forum, I cut from the wrong test.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can play around with the regular input tag with CSS.
If I remember correctly, whenever you submit a form, the values of all of the buttons get passed with the form.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic