On Apr 10, 2006, at 4:39 PM, Sean Jamieson wrote:
> heh, yeah, I thought it sounded a bit crazy, but I thought of that
> just
> after waking up this morning.
Don't give up, crazy ideas sometimes turn out to be the best ones... :)
> pseudo example:
> class MyForm( WidgetForm ):
> Name = TextField(label=...[, class=..., value=..., size=..., ...])
> Value = TextField(label=...[, class=..., value=...,
> size=..., ...])
> Submit = SubmitButton(value=...[, name=..., class=...])
>
> def _validateName( self, value ):
> if len( value ) < 4:
> return false
> if not value.isalnum():
> return false
> ...etc...
You can use something smilar to de "declarative" style you're
proposing using WidgetList and the current API:
class NameValidator(FancyValidator):
def to_python(self, value, state=None):
# your validtion code here, raise Inavalid in not valid, return
coerced value
class MyFormFields(WidgetList):
name = TextField(validator=NameValidator())
value = TextField(...)
submit = submitButton(...) # You don't really need it as the form
provides...
class MyForm(Form):
fields = MyFormFields()
>
> Anyway, that's my fantasy, I may make it my own reality eventually.
well, I'd encourage you to share your fantasies (Widget related)
here, If they're good they will likely be part of TG for everyone to
enjoy.
Regards,
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---