in SQLFORM.factory I have defined a radio check box.

Field('primary_email_choice_new', widget=SQLFORM.widgets.radio.widget, 
requires=IS_IN_SET({'Work' : 'Work', 'Home' : 'Home'})),                   
             

It shows on the form but I need to set it checked="yes" one of the values.

The generated HTML is:
<div><table class="string" id="no_table_primary_email_choice_new" 
name="primary_email_choice_new"><tr><td>
<input id="primary_email_choice_newHome" name="primary_email_choice_new" 
type="radio" value="Home" />

<label for="primary_email_choice_newHome">Home</label></td></tr><tr><td>
<input id="primary_email_choice_newWork" name="primary_email_choice_new" 
type="radio" value="Work" /><label 
for="primary_email_choice_newWork">Work</label></td></tr></table></div>

If I know how to make one of the values checked it would be:
The generated HTML is:
<div><table class="string" id="no_table_primary_email_choice_new" 
name="primary_email_choice_new"><tr><td>
<input id="primary_email_choice_newHome" name="primary_email_choice_new" 
type="radio" value="Home" checked="yes"/>

<label for="primary_email_choice_newHome">Home</label></td></tr><tr><td>
<input id="primary_email_choice_newWork" name="primary_email_choice_new" 
type="radio" value="Work" /><label 
for="primary_email_choice_newWork">Work</label></td></tr></table></div>


How to do that?


Reply via email to