Skip to main content

RadioButton

2 replies [Last post]
heziflash
Offline
Joined: 2008-06-03

Hi

I have grouped 2 radio buttons (rb3, rb4).
I want rb3 to be the default (means he will get the focous & will be choosen automatcly)
Can i do it?

Here is my code:

RadioButton rb3 = new RadioButton("Yes");
RadioButton rb4= new RadioButton("No");

ButtonGroup group2 = new ButtonGroup();
group2.add(rb3);
group2.add(rb4);
rb3.requestFocus();
rb3.getStyle().setMargin(1, 0, 2, 2);
rb4.getStyle().setMargin(0, 0, 2, 2);
RegFangForm.addComponent(rb3);
RegFangForm.addComponent(rb4);

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
heziflash
Offline
Joined: 2008-06-03

Thanks. it works.

elie
Offline
Joined: 2008-06-11

Dear Friend,

you can try the below hope this will help:

ButtonGroup group2 = new ButtonGroup();
rb3.requestFocus();
rb3.getStyle().setMargin(1, 0, 2, 2);
rb4.getStyle().setMargin(0, 0, 2, 2);
group2.add(rb3);
group2.add(rb4);
group2.setSelected(0);

RegFangForm.addComponent(group2);

regards