It acts a bit differently -- first form (one) is displayed and
accepted, and then second form (two) is displayed and when I fill in
the field and hit submit, it takes me back to the first form?
Is this proper use of the LOAD component, or should I not use my forms
with this function?
--Marc
Sorry -- it started nice, but as I moved and tried different things,
it got a bit messy.
>
> Your other strategy of loading the forms via ajax looks promising,
> but it looks like it would always load 'one' in the example given:
> {{=LOAD(c='default', f='mobile_verify', args='one', extension='load',
> ajax=True)}}
Correct -- the first "page" (form one) it would always display is
mobile_verify/one (the start of the "wizard").
>
> I would recommend that you look at the admin app which comes with
> web2py. Look at the controller 'wizard.py' and check out the views
> etc. Spending a few minutes doing that may give you the inspiration
> to take a slightly different approach. At least in making your code a
> little cleaner.
Yes, their example is very nice -- using separate functions for the
steps does make it look a lot cleaner, however, they aren't using the
LOAD feature for the wizard (the browser goes to a new URL for each
step).
Maybe the LOAD / AJAX stuff just doesn't work with multiple steps /
forms like I'm trying to do?
Has anyone ever gotten it to work this way?
Its not the end of the world, I can have the wizard go to new pages
each time, but I just wanted to try something different. =)
--Marc
--Marc
An exemple, please?
My mobile phone, 123456789, what's the code for sending a SMS?
On 17 feb, 22:46, Massimo Di Pierro <massimo....@gmail.com>
wrote:
> One solution is to send sms via emails. It is cheap, reliable and does
> not rely on third party services:
>
> web2py/gluon/contrib/sms_utils.py
>
> On Feb 17, 3:42 pm, Ovidio Marinho <ovid...@gmail.com> wrote:
>
>
>
>
>
>
>
> > what makes your application, it sends sms:? you can share this application?,
> > I need an application that sends SMS.
>
> > 2011/2/15 Marc Smith <msmi...@gmail.com>
> > ovid...@gmail.com
{{extend 'layout.html'}}
{{=LOAD('default','wizard.load', vars={'page': 1}, ajax=True)}}
{{=A('Page 2',_href=URL('default', 'wizard.load', vars={'page': 2}), cid=request.cid)
controller/default.py
def wizard():
if request.vars.page==1:
content='blabla'
elif request.vars.page==2:
content='blabla page2'
return dict(content)
Yes, that works well for trapping links inside the component, but what
about using forms? Have you ever used multiple forms instead of links
from one page to another like you are doing below?
Thanks,
Marc
The redirect inside of the LOAD component does seem to work fine --
when I click the submit button on the first page/form, it goes to the
next page/form inside of the DIV component (the whole page / URL is
NOT changed). The problem seems to do with using a second form inside
of the same DIV component -- the form doesn't submit properly or
something wrong with the second redirect.
I also noticed when I progress from the first form to the second, the
AJAX "flash" message appears, and then I click that box, it goes away
(the flash message), and then right after the same message is
displayed again, but instead of the fade in (like flash message uses),
it slides down like the error messages do. Crazy eh?
I don't know enough about JavaScript / AJAX, but I'm pretty confident
the problem lies there -- probably with the web2py_trap_form function.
I tested another theory, if in the LOAD function I specify the second
form/page as the start point, that form works fine (page two ->
three). So it seems its only an issue when having already had one form
completed and then trying to submit the next.
Again, this form wizard thing works fine when not using the LOAD component.
> form = SQLFORM(db.mywiz)
> if form.accepts(request.vars, session):
> response.flash = 'form submitted'
> form = LOAD('default','wizard.load', vars={'page': 2}, ajax=True)
> return dict(form=form)
This seems to create a second LOAD component inside the first DIV, so
not quite what I'm looking for.
--Marc
>
>
>
> 2011/2/18 Marc Smith <msmi...@gmail.com>
Carlos: Is this fine to keep the response stuff in there? And to keep
the web2py_ajax.html modifications? It won't affect other forms or
anything else?
Thanks!
--Marc
On Fri, Feb 18, 2011 at 12:48 PM, Martín Mulone <mulone...@gmail.com> wrote:
>> This seems to create a second LOAD component inside the first DIV, so
>> not quite what I'm looking for.
>
> You are right my bad, let me think about it.
> 2011/2/18 Marc Smith <msmi...@gmail.com>