Merge pull request #27 from petterreinholdtsen/forms-radio-buttons

Add support for radio buttons.
This commit is contained in:
Nick Daly 2013-09-28 10:46:32 -07:00
commit f69549c480

View File

@ -142,6 +142,16 @@ class Form():
<span>%s</span>
<input type=checkbox name="%s" id="%s" %s/>
</label></div>\n""" % (label, name, id, checked)
def radiobutton(self, label='', name='', id='', value='', checked=''):
name, id = self.name_or_id(name, id)
if checked:
checked = 'checked="on"'
self.text += """
<div class="radio">
<label>
<span>%s</span>
<input type="radio" name="%s" id="%s" value="%s" %s/>
</label></div>\n""" % (label, name, id, value, checked)
def get_checkbox(self, name='', id=''):
return '<input type=checkbox name="%s" id="%s" />\n' % self.name_or_id(name, id)
def render(self):