radio button behavior unlike dropdown
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
web.py |
Confirmed
|
Medium
|
Anand Chitipothu |
Bug Description
The Radio class buttons currently don't allow tuple inputs of (value, desc) like the Dropdown class allows. Additionally, the Radio buttons don't set up a label for the description.
The following patch fixes both of those issues.
@@ -155,9 +155,15 @@
def render(self):
x = '<span>'
for arg in self.args:
- if self.value == arg: select_p = ' checked="checked"'
+ if type(arg) == tuple:
+ value, desc= arg
+ else:
+ value, desc = arg, arg
+
+ if self.value == value: select_p = ' checked="checked"'
else: select_p = ''
- x += '<input type="radio" name="%s" value="%s"%s%s /> %s ' % (net.websafe(
+ radio_id = net.websafe(
+ x += '<input type="radio" name="%s" id="%s" value="%s"%s%s /><label for="%s"> %s</label> ' % (net.websafe(
return x+'</span>'
Changed in webpy: | |
assignee: | nobody → anandology |
importance: | Undecided → Medium |
milestone: | none → 0.3 |
status: | New → Confirmed |
Changed in webpy: | |
milestone: | 0.3 → 0.31 |
Changed in webpy: | |
milestone: | 0.32 → 0.33 |
Changed in webpy: | |
milestone: | 0.33 → 0.35 |
Here's the patch attached as a file.