• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how to check radio button?

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

here i have two radio buttons, they are

<html:radio name="alertOptionsBean" property="ascdesc2" value="asc"/> Ascending<br>

<html:radio name="alertOptionsBean" property="ascdesc2" value="desc"/> Descending

I want to make one as default(either asc or desc order)

Could you help me regarding this issue?

thanking you, advancely.
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't exactly remember the option. If there is an attribute named 'selected' in the html:radio tag, you can place that to make that option selected by default!
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sai roy ,


If you are using DyanaActionForm then a code "INTITAL" in
struts-config.xml file
....
<form-property name="ascdesc2" type="java.lang.String" initial="asc"/>

...


so that radio button correrspanding to "asc" checked by default
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're not using DynaActionForm, you can override ActionForm's reset(...) method and set it there, or set it in an action that forwards to this JSP.
 
saidi Bandi
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friend,

what iam asking is when i opened the page the button has to seen as checked?
please see the code what i mentioned
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sai roy:
when i opened the page the button has to seen as checked


Yes, I understand that. What we are telling you is that if you set the ActionForm property associated with the radio button to the correct value, Struts will automatically make it appear as checked when it is displayed.
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic