I'm working on a widget and I can't figure out how to make the error
handling magic happen. When i have errors in the form, things just
crash if i'm using my widget in the TableForm. Are there some methods
or properties i need to provide to keep everything working? What
would i need to do if i wanted to create my own error handlers for my
widget? Right now the widget is inheriting from SelectionField
because it provides a lot of the properties and methods i need.
here's the widget definition for reference:
----------------------------
class ToggleRelatedJoin(widgets.SelectionField):
options = [ (1,'lions'),(2,'tigers'),(3,'bears')]
validator = validators.Set()
def __init__(self,label=None,*args,**kargs):
super(ToggleRelatedJoin,self).__init__(args,kargs)
self.javascript.append( widgets.JSLink('cha_tg', "javascript/
jquery.js") )
self.javascript.append( widgets.JSLink('cha_tg', "javascript/
toggle.js") )
self.css.append( widgets.CSSLink('cha_tg','css/toggle.css') )
self.label=label
template = '''
<fieldset xmlns:py="http://purl.org/kid/ns#">
<span py:for='option in options' class='trj_toggle'>
<input type='checkbox' id='trj_toggle_${option[0]}'
name='$
{self.name}' value='${option[0]}' py:attrs="checked=std.selector(value
and option[0] in value)" />
<a href="${option[0]}/toggle"
id='trj_title_${option[0]}' class="$
{option[0] in value and 'trj_on' or 'trj_off'}">${option[1]}</a>
</span>
</fieldset>
'''
-----------------------------
the widget takes two variables, 'value' and 'options' - options is a
list of name:bool pairs and value is a list of names which are True.
there's some javascript and CSS to style True and False differently.
-Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---