On Tue, 2009-09-29 at 14:43 -0700, cd34 wrote:
> The very minimal controller you need to do the ToscaWidgets movie
> tutorial is:
>
>
Thanks a lot cd34 (I don't know your real name ).
Thanks graham for more updates on the same issue.
I have a couple of questions about using the provided example code for
tw.forms and I have put them inline with the code.
>
> from pylons import request, response, session, tmpl_context
> from tw.mods.pylonshf import validate
> import tw.forms as twf
>
> from cp.lib.base import BaseController, render
>
> movie_form = twf.TableForm('movie_form', action='save', children=[
> twf.HiddenField('id'),
> twf.TextField('title'),
> twf.TextField('year', size=4),
> twf.CalendarDatePicker('release_date'),
> twf.SingleSelectField('genera', options=['', 'Action', 'Comedy',
> 'Other']),
> twf.TextArea('description', validator=twf.validators.NotEmpty),
> ])
I did not see any code specifying that the form will be rendered using
mako.
Don't we need to set the engine to mako, or is it not really necessary?
> class TestController(BaseController):
>
> def index(self):
> tmpl_context.form = movie_form
> return render('/movie.mako')
>
> @validate(movie_form, error_handler='index')
> def save(self, **kw):
> return str(kw)
>
> and movie.mako would contain:
>
> ${tmpl_context.form()|n}
What is the meaning of |n in that mako tenplate?
> Example taken from:
>
> http://toscawidgets.org/documentation/tw.forms/tutorials/index.html
>
> The page:
>
> http://toscawidgets.org/documentation/tw.forms/tutorials/validate_pylons.html
>
> contains an error in the validate string which is missing the quotes
> around the error_handler.
>
> @validate(form=movie_form, error_handler=index)
>
> should be replaced with:
>
> @validate(form=movie_form, error_handler='index')
Thanks again.
By the way is it perfect to use url_for() to generate the action for the
submission of the form?
Happy hacking.
Krishnakant.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---