• Post Reply Bookmark Topic Watch Topic
  • New Topic

Last question for today-->Radio button  RSS feed

 
Jeff Dube
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,
I am able to validate check boxes and print the selected one with the following:
<%! Strig[] result;%>
...
<%result = request.getParameterValues("Employees");
if (result != null)
{
for (int i = 0; i < result.length; i++)
{
out.println (result[i]+ ", ");
}
}
result = null;
%>
I need to do the same with radio button (print the selected one) but the :
if (result[0].checked == true) or
if (result[0].isSelected == true)
are not available.
Thank you for your last help of the week!!!
Jeff
 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that if you you just get the value from the request parameter you should get the value.
ex.
String value = request.getParameter("radioButton");
with radioButtons it will only send up at most one value from the group of buttons.
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve is correct. All you need to do is check for the value. Say you have a copuple of radio buttons, with values of Red & Blue, getParameter should give you the value of the one that's selected.
Bosun.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!