Can someone direct me towards some examples and/or documentation on
how to do end-to-end form validation with TG 2.1? I don't want to use
any widgets, as my forms are rather complex and require quite a bit of
custom styling/layout.
I have a formencode.Schema derived class, which defines fields and
validators. In my controller I have the following annotation...
@validate(validators=MyForm(), error_handler=get)
def post(self, .....)
I have a form defined in genshi, using the webhelpers...
<p class="field">
<label for="first_name">Enter your first name:</label>
${h.html.tags.text('first_name', value=c.form_result['first_name']
or '', id="first_name")}
<input type="text" id="first_name" name="first_name" value=""
class=""/>
<span class="error">${c.form_errors['email']}</span>
</p>
Now, I can't seem to find a straightforward way to do form value and
error filling when something fails.
I need to prefil the form with submitted params when the error_handler
is called as well as some way to inject the values. Right now, it
complains about various entries not present in form_result and
form_errors dictionaries. I can resort to checking for each entry,
but that's rather tedious.
Is there some nice/streamlined way to accomplish this with
turbogears? Also, I'm using Genshi templates (if that matters).
Thanks.
Ilya
--
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.