help with book examples... ??

20 views
Skip to first unread message

samuel bonilla

unread,
Jun 14, 2013, 4:54:40 PM6/14/13
to web...@googlegroups.com
hi all, i'm from colombia, I do not speak English... this is a translater of google... translate.google.com.co

when I insert my name on the form do not nothing
why in the second view .... name = request.vars.visitor_name or redirect(URL('first')) return None ???

def first():
    form = SQLFORM.factory(Field('visitor_name', requires=IS_NOT_EMPTY()))
    if form.process().accepted:
        name = form.vars.visitor_name
        redirect(URL('second',vars=dict(name=name)))
    return dict(form=form)

def second():
     name = request.vars.visitor_name or redirect(URL('first'))
     return dict(name=name)

vews...

first.html

{{extend 'layout.html'}}

{{=form}}


second.html

{{extend 'layout.html'}}

<span> hola <strong>{{=name}}</strong> </span>

Niphlod

unread,
Jun 14, 2013, 5:07:47 PM6/14/13
to web...@googlegroups.com
uhm .... the red parts must be equal


def first():
    form = SQLFORM.factory(Field('
visitor_name', requires=IS_NOT_EMPTY()))
    if form.process().accepted:
        name = form.vars.visitor_name
        redirect(URL('second',vars=dict(name=name)))
    return dict(form=form)

def second():
     name = request.vars.visitor_name or redirect(URL('first'))
     return dict(name=name)

if you change "second" to

def second():
     name = request.vars.name or redirect(URL('first'))
     return dict(name=name)

it should work.

samuel bonilla

unread,
Jun 14, 2013, 5:28:09 PM6/14/13
to web...@googlegroups.com
not found in the second.html vew show...

hola None

why ??


are wrong the example in the book ???


2013/6/14 Niphlod <nip...@gmail.com>
--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/jZX-Kvdo7bU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Niphlod

unread,
Jun 14, 2013, 6:04:50 PM6/14/13
to web...@googlegroups.com
it works fine here.

if you found the example in the book, it needs to be updated.

web2py.app.works.w2p

samuel bonilla

unread,
Jun 14, 2013, 6:33:20 PM6/14/13
to web...@googlegroups.com
thanks for you help Niphlod.... i go continue learning.... thanks


2013/6/14 Niphlod <nip...@gmail.com>
it works fine here.

if you found the example in the book, it needs to be updated.
Reply all
Reply to author
Forward
0 new messages