Automatic radio check using spacers

I have a jsp page with two radio tags.

The page contains the struts2 form. When I submit the form, one of the two radio stations should be automatically checked.

Can this be done?

0


source to share


2 answers


One of the radio input functions is that an element in the selected radio receiver cannot be canceled, except for another member of the selected set (as opposed to the set checkbox "set"). those. if you initialize the page with selection, you can ensure that you have a value. Is there a default that you can do this for? Then you can just set checked="checked"

to that item.



Alternatively, you just need to add another validation rule in JS and / or server side.

+2


source


I believe that with:

<html:radio property="foo" value="yes"/>

      



this radio tag will show selected (default) if the getFoo()

form-bean method returns the string "yes".

Maybe you can use this to bind your form to submit to your radio labels?

0


source







All Articles