• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Radio buttons.......

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have two radio buttons. Depending on which one the user selects, I need to assign different value to a href tag.
ie, if the user selects,
(1) radio button one - then <a href="Servlet1?param1=value1">
(2) radio button two - then <a href="Servlet2?param2=value2">
How do I do this?
Thanks for any input.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bala!
Do you mean for your radio buttons to be from different groups? In your note above, radio 1 sets "param1" and radio 2 sets "param2". It would be more logical to have both radios set "paramX" with value 1 or value 2.
To make this more clear, the HTML code would look like so:
<INPUT TYPE="radio" NAME="MyRadio" VALUE="Yes">
<INPUT TYPE="radio" NAME="MyRadio" VALUE="No">
Since you are already using a form, use an image that looks like an HREF to submit.
<INPUT TYPE="image" SRC="LooksLikeAnHref.gif">
If the action of your form is the servlet, clicking on the input image will submit paramX to the servlet.
Hope this helps!

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do something like this (if I understood you correctly)
 
Bala Krishniah
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much!!
 
I do some of my very best work in water. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic