Re: [web2py] Re: form in layout.html?

2012-05-09 Thread Anthony
On Wednesday, May 9, 2012 6:23:53 PM UTC-4, sebastian wrote: > > the ajax_trap=True fixed the form which nows call search_bar... but > redirect(URL('services', vars={'qry':form.vars.qry})) is rendered inside > the component > > What I'm trying to do, is to include a simple form in the layout

Re: [web2py] Re: form in layout.html?

2012-05-09 Thread Sebastian E. Ovide
the ajax_trap=True fixed the form which nows call search_bar... but redirect (URL('services', vars={'qry':form.vars.qry})) is rendered inside the component What I'm trying to do, is to include a simple form in the layout.html that calls a function (as it is now, with the ajax_trap trick), and

[web2py] Re: form in layout.html?

2012-05-09 Thread Anthony
As it is, your component is not an Ajax component, and it is also not set up to trap form submissions via Ajax. So, when you submit the form, it will be submitted to the function of the parent page, not to the search_bar function. If you want the component to be loaded via Ajax, then set ajax=T

[web2py] Re: form in layout.html?

2012-05-09 Thread sebastian
in default.py I have def search_bar(): form = FORM('Search ',INPUT(_name='qry')) if form.process().accepted: response.flash='' if form.vars.qry: redirect(URL('services', vars={'qry':form.vars.qry})) return form and in layout.html {{=LOAD('default','search

[web2py] Re: form in layout.html?

2010-06-21 Thread mdipierro
You can also do if response.flash: response.headers['web2py-component- flash']=response.flash before return and you can keep using response.flash and session.flash as usual. On Jun 21, 10:10 am, Iceberg wrote: > Wow, thanks very much for sharing this trick. I knew it could be easy > and elegant

[web2py] Re: form in layout.html?

2010-06-21 Thread Iceberg
Wow, thanks very much for sharing this trick. I knew it could be easy and elegant! :-) On Jun20, 10:15pm, mdipierro wrote: > Because the form is submitted and returned via ajax the usual > mechanism does not work but you can do: > > def form(): >     form=SQLFORM.factory( >        Field('name', r

[web2py] Re: form in layout.html?

2010-06-20 Thread mdipierro
Because the form is submitted and returned via ajax the usual mechanism does not work but you can do: def form(): form=SQLFORM.factory( Field('name', requires=IS_NOT_EMPTY())) if form.accepts(request.vars, session): response.headers['web2py-component-flash'] = 'form accepted

Re: [web2py] Re: form in layout.html?

2010-06-19 Thread Giuseppe Luca Scrofani
I need this solution too... Maybe with some help from javascript? Some days ago testing various appliances from the repository I encountered an example of submit button, when clicked it will open a dialog with a personalized message. I will try to find it again... (the typical flash response howev

Re: [web2py] Re: form in layout.html?

2010-06-19 Thread Julius Minka
def form(): form=SQLFORM.factory( Field('name', requires=IS_NOT_EMPTY())) if form.accepts(request.vars, session): response.flash = 'form accepted' else: response.flash = 'form has errors' return form Flash is not displayed in this place, elsewhere is working.

Re: [web2py] Re: form in layout.html?

2010-06-19 Thread Julius Minka
Thank You, that is really simple. Julius V Sobota, 19. jún 2010 o 00:41 -0700, mdipierro napísal(a): > Just do > > def contact(): > form=SQLFORM.factory() > if form.accepts() > return form # not dict(form=form) > > and in layout.html > > {{=LOAD('default','contact')}} >

[web2py] Re: form in layout.html?

2010-06-19 Thread mdipierro
Just do def contact(): form=SQLFORM.factory() if form.accepts() return form # not dict(form=form) and in layout.html {{=LOAD('default','contact')}} On Jun 18, 11:26 am, Julius Minka wrote: > I need a contact form (name, address,...) on every page of a web site. > Thin