[web2py] Re: Book overview form appearance
On Friday, October 21, 2011 2:38:49 PM UTC-4, Paul wrote: I am just starting with web2py. I am going through the online book. When I do the final MyApp, the word form appears on the page. From where did this come? Likewise, the line {{=BEAUTIFY(response._vars)}} was automatically gennerated and appears to display the form a second time. The word form and the second instance of the form are being generated by the {{=BEAUTIFY(response._vars)}}. How did that get in your view file? Can you show the exact code of your controller action and view file? Do you have {{=BEAUTIFY(response._vars)}} in your layout.html file? Anthony
[web2py] Re: Book overview form appearance
To my knowledge, the BEAUTIFY line came with the default view file. I certainly would not know to type that line. Is there a configuration setting that I have changed or need to change? def first(): form = FORM(INPUT(_name='visitor_name', requires=IS_NOT_EMPTY()), INPUT(_type='submit')) if form.process().accepted: session.visitor_name = form.vars.visitor_name redirect(URL('second')) return dict(form=form) {{extend 'layout.html'}} What is your name? {{=form}} {{=BEAUTIFY(response._vars)}}
[web2py] Re: Book overview form appearance
On Friday, October 21, 2011 4:46:31 PM UTC-4, Paul wrote: To my knowledge, the BEAUTIFY line came with the default view file. What do you mean by default view file? The book tutorial instructs you to create a /views/default/first.html view file from scratch.
[web2py] Re: Book overview form appearance
On Friday, October 21, 2011 5:50:30 PM UTC-4, Paul wrote: The from scratch steps I too were from the Admin page Views section. I entered first intot the create file with filename edit control and chose the Create button. When I do this in a new application, the resulting first.html file contains: {{extend 'layout.html'}} h1This is the first.html template/h1 {{=BEAUTIFY(response._vars)}} Yes, that's just a template generated by the admin app. You can delete all that and enter your own code. You can also just create a view file from scratch using any text editor (no need to use admin). Note, response._vars is the dictionary returned by the controller function, and the BEAUTIFY helper turns lists and dictionaries of objects into HTML. So, {{=BEAUTIFY(response._vars)}} is a quick and easy way to display the objects returned by the controller without having to really code a view. It would typically be used for development purposes during prototyping. Anthony