I would define the form outside any action and and accept it in two different actions.
Massimo On Oct 11, 5:53 pm, kev <[EMAIL PROTECTED]> wrote: > Ok take facebook for example. > > When you visit the site, see the form on the main page. Lets say the > main page is rendered by default.py. Now you can also register not > only from main page but from facebook.com/r.php. Lets say i want > something like that so you can register from default.py and user/ > register.py > > Instead of creating two SQLFORMs (one in default and one is user/ > register.py) -> is there a way i can render the register form in > default view? > > I tried doing {{include 'user/register.html'}} but the problem is > register view needs the form variable {{=form}}. > > Kevin > > On Oct 11, 5:56 pm, mdipierro <[EMAIL PROTECTED]> wrote: > > > Not sure I understand. There is one action that generates the form, > > display the form, processes the form. > > Upon success you redirect. Then the for is gone. Are you talking about > > a second page of the form? > > > Massimo > > > On Oct 11, 12:10 pm, kev <[EMAIL PROTECTED]> wrote: > > > > Ok than how would i put a register form in the default page (which is > > > controlled by the default.py), If register box is generated by user -> > > > register.py. > > > > Thanks for the help, > > > Kevin > > > > On Oct 11, 10:55 am, mdipierro <[EMAIL PROTECTED]> wrote: > > > > > This is not the way the go. Submitting forms to a different actions > > > > other than the one generating the form is not a good software > > > > engineering pattern. Forms should always self submit and redirect on > > > > success. I suggest: > > > > > form=SQLFORM(...) ## no _action=.... > > > > if form.accepts(request.vars): > > > > redirect(URL(r=request,c='user',f='register')) > > > > > Anyway, your code should work. You are either not saving the session > > > > or overriding the key (multiple forms per page). > > > > To avoid the problem do not pass "session" to accepts(). > > > > > Massimo > > > > > On Oct 10, 9:59 pm, kev <[EMAIL PROTECTED]> wrote: > > > > > > Ok so i have a little problem which i cant seem to solve. > > > > > > In default.py controller i have a SQLFORM to display registration > > > > > form. Now in the SQLFORM i have _action=URL(r=request, c='user', > > > > > f='register') which transfer the form over to user/register. (i want > > > > > to make controller for different things like user, gallery, etc). > > > > > > Now the problem is the user/register does form=SQLFORM(...) and makes > > > > > the form and tries to do form.accept with the request.vars sent from > > > > > default. It doesn't seem to work at all and always fails the accepts > > > > > test because i think formkey isn't getting passed or something. > > > > > > Thanks. > > > > > Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---