Skip to content

Commit

Permalink
Fixes a couple of bugs in the CTK.Radio() class.
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/CTK/trunk@6760 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jun 11, 2011
1 parent a6987f9 commit a370eb8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CTK/Radio.py
Expand Up @@ -68,14 +68,21 @@ def __init__ (self, key, options, _props={}):
if not 'id' in self.props:
self.props['id'] = 'RadioGroup_%s' %(self.uniq_id)

cfg_value = cfg.get_val (key)

for o in options:
val, desc = o

new_props = {}
new_props['name'] = key
new_props['value'] = val

if 'checked' in self.props:
# Initial value
if cfg_value != None and \
cfg_value == val:
new_props['checked'] = 1

elif 'checked' in self.props:
if self.props['checked'] == val:
new_props['checked'] = 1

Expand All @@ -91,4 +98,4 @@ def __init__ (self, txt, props={}):

self.text = Box ({'class': 'radio-text'}, RawHTML(txt))
self += self.text
self.text.bind('click', "$('#%s').attr('checked', true);" %(self.radio.id))
self.text.bind ('click', "$('#%s').attr('checked', true).trigger('change');" %(self.radio.id))

0 comments on commit a370eb8

Please sign in to comment.