*bump*
Anyone have experience with this? I've created a new widget that I'm
trying to use with TableForm, but every time there's a validation
error the site chokes because the widget doesn't know how to handle
the error. Am I missing something?
-Ryan
On May 23, 1:20 pm, kerinin <[EMAIL PROTECTED]> wrote:
> I'm working on awidgetand I can't figure out how to make theerror
> handling magic happen. When i have errors in the form, things just
> crash if i'm using mywidgetin 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 ownerrorhandlers for mywidget?
> Right now thewidgetis inheriting from SelectionField
> because it provides a lot of the properties and methods i need.
>
> here's thewidgetdefinition 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>
> '''
> -----------------------------
> thewidgettakes 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
-~----------~----~----~----~------~----~------~--~---