V Sobota, 7. august 2010 o 10:20 -0700, mdipierro napísal(a):
> Is your problem the presence of the .load?
>
No, that is not the main problem.
> > url=URL(r=request, f='nehnutelnosti',vars={'typ':request.vars.typ,
> > 'okres':request.vars.okres, 'druh':request.vars.druh})
> > can not be used because it returns
> > /app/default/nehnutelnosti.load?okres=1&typ=1&druh=2
>
> if you you can specify URL(....,extension='html')
url=URL(r=request, f='nehnutelnosti', vars={'typ':request.vars.typ,
'okres':request.vars.okres, 'druh':request.vars.druh},extension='html')
not change, result is still
/app/default/nehnutelnosti.load?okres=1&typ=1&druh=2
MAIN problem is the redirect doesn't work:
if form.accepts(request.vars, session):
url="/"+request.application
+"/default/nehnutelnosti.html?okres="+request.vars.okres
+"&typ="+request.vars.typ+"&druh="+request.vars.druh
raise HTTP(303,**{'web2py-component-command':'document.location="%s"'%
url})
Julius
>
>
> On Aug 7, 12:13 pm, Julius Minka <[email protected]> wrote:
> > Massimo,
> >
> > I am not able to make it work.
> >
> > Firstly, just little note, my original
> > url=URL(r=request, f='nehnutelnosti',vars={'typ':request.vars.typ,
> > 'okres':request.vars.okres, 'druh':request.vars.druh})
> >
> > can not be used because it returns
> > /app/default/nehnutelnosti.load?okres=1&typ=1&druh=2
> >
> > so it probably rightly doesn't redirect to the new page.
> >
> > Secondly, I tried for testing purposes to construct url 'by hand', both
> > versions:
> > 1.http://127.0.0.1:9999/app/default/nehnutelnosti?okres=1&typ=1&druh=2
> >
> > 2.
> > /app/default/nehnutelnosti?okres=1&typ=1&druh=2
> >
> > Form disappears, but that is all what happens after submit.
> >
> > Form looks following in the page source:
> > <script type="text/javascript"><!--
> > web2py_component("/real/default/form.load","c712094659208")
> > //--></script><div id="c712094659208">loading...</div>
> >
> > What else could be the problem with redirection?
> > Julius
> >
> > V Štvrtok, 5. august 2010 o 15:23 -0700, mdipierro napísal(a):
> >
> > > This is the intended behavior.
> > > for now you can do
> > > instead of
> >
> > > redirect(url)
> >
> > > use
> >
> > > raise HTTP(303,**{'web2py-component-
> > > command':'document.location="%s"'%url})
> >
> > > On Aug 5, 1:17 pm, Julius Minka <[email protected]> wrote:
> > > > Having something like this
> >
> > > > {{=LOAD('controller','action.load',vars={},args=[],ajax=True)}}
> >
> > > > in the layout.html
> > > > and something like this
> >
> > > > form=SQLFORM.factory(
> > > > Field(...),
> > > > Field(...),
> > > > Field(...),
> > > > formstyle='table2cols',submit_button='Vyhľadať')
> > > > if form.accepts(request.vars, session):
> > > > redirect(URL(r=request,
> > > > f='2action',vars={'typ':typ}))
> >
> > > > in action controlller.
> >
> > > > It almost works, but instead of redirection to '2action', it displays
> > > > 2action page in the space where previously the form was. URL is not
> > > > changed.
> >
> > > > Is this expected behaviour?
> > > > How to correctly do real redirection to 2action page?
> >
> > > > Julius