Add support for radio buttons.

This commit is contained in:
Petter Reinholdtsen 2013-09-19 12:35:16 +02:00
parent 0954d9d383
commit 3c78b92d04

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):