File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

select a RADIO option by default

 
Anwarul Kabir
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have this code to produce a radio options


now it shows up in html like this
Validation: 0 Passed 0 Failed 0 Both

The problem is i want to select Both by default but i am clue less what to do.

Please help

BTW when one of the radio button gets selected the value is held here
searchBean.validationType

and this is giving the different types from an enum named validationTypes
model.ui.Lookup.validationTypes

And this is getting the label from Application Properties file
#{m[option.name]}


Please Help!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preset validationType to the desired default value. You can do that in for example the constructor of the bean.
 
Rahul Juneja
Ranch Hand
Posts: 425
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do something like this.

In your view:



where f refers to:

and you bean can have something like this:



bean.setSelectedValue("Put the value you want to select from the enum or bean);

Thanks,
Rahul
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now the first value added in the array will be selected by default.
This is untrue.
 
Rahul Juneja
Ranch Hand
Posts: 425
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke Scholtz wrote:
Now the first value added in the array will be selected by default.
This is untrue.


You are right, I did change my statement above so that the new user who sees doesn't get confused.

Thanks,
Rahu
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question was already answered in the 1st reply. There is no need to repeat the answer and also not to add irrelevant information to it (the problem was not how to populate the list, but how to set a default value).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic