Hi Daniel,
> Firstly, the submit button doesn't seem to respect the
> "params={'value': 'Submit'}" bit. Which is strange, because everything
> else seems to work,
I've changed the docs in SVN to use options rather than params so it
will work in future. I wonder if it is anything to do with a conflict
with the legacy Pylons params object. Anyway, options should do it.
and I think the getattr(c.form.field, ...) line is
> a really excellent hack.
It is quite flexible and I find it rather useful.
> I'd also like to know what the "field = basic.HtmlFields(),
> compound.HtmlFields()" line does inside the MainForm(Form) class.
This is all described in the main FormBuild Getting Started Manual
rather than the Using Pylons with FormBuild one.
http://formbuild.org/docs/manual.html
> Is there an example somewhere which shows how to handle creating and
> editing with the same form via FormBuild?
No, but you do something like this with the handle function
http://formbuild.org/docs/module-formbuild.html
import formbuild
defaults, errors, response = formbuild.handle(
# The FormEncode schema to validate input
schema=CustomFormEncodeSchema(),
# The template with the FormBuild form
template='form.myt',
# Any data to populate the form with
data={'name':'james'},
# The FormBuild form object used to build the form
form=MainForm
)
if response:
# There was an error, show the autogenerated response
return response
else:
# There were no errors, save the result
for k, v in defaults.items():
# do something
pass
> This library looks really promising! I'm really looking forward to
> finally abstracting away all of the boring stuff for good with Pylons.
It is pretty good, the real power though is when you create your own
Form types described in the manual. Like you pointed out I really need
to write some docs about how to use it properly and I need to write some
code that autogenerates the formbuild form, formencode schema and
SQLAlchemy tables from the same set of data. One day, when I have some
time I expect I will!
Hope that helps,
James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss
-~----------~----~----~----~------~----~------~--~---