continue my testing in another discussion :
https://groups.google.com/forum/#!topic/web2py/I0qpV7P_Vrw

but much smaller (without session, without validation, to see how form work 
in components)

test from the book about components : it works well, when i go futher, 
split it into 2 functions, it still work, but when the split function that 
have form, have a condition if form.process(), it can't response directly
*e.g. from book split into 2 functions works*
*controllers/default.py*
@auth.requires_login()
def post():
    form = SQLFORM(db.comment_post).process()
    return dict(form = form)

def show():
    comments = db(db.comment_post).select()
    return dict(comments = comments)

*views/default/post.load*
{{=form}}

*views/default/show.load*
{{for post in comments:}}
<div class="post">
  On {{=post.created_on}} {{=post.created_by.first_name}}
  says <span class="post_body">{{=post.body}}</span>
</div>
{{pass}}

*e.g. split function that have form, have a condition, it can't response 
directly*
*controllers/default.py*
@auth.requires_login()
def post():
    form = SQLFORM(db.comment_post)
    if form.process().accepted:
        response.js = "jQuery('#show').get(0).reload()"
        #response.flash = "test"
        session.flash = "test"
    elif form.errors:
        #response.flash = "Form has errors"
        session.flash = "Form has errors"
    return dict(form = form)

*expected result : *
the form have response flash after submit, and then reload the show load 
component. 

*result i got : *
the form didn't have response flash at all (not responding), yet the value 
is insert in database, the show load component is not reload, i must 
refresh the page to show new inserted value

already tried to give a comment the response.js to expect result just a 
response flash, but it still not show it after first submit

i think, it seems the code below the if conditional form process is not 
executed on the first submit. (please correct me if i'm wrong about this)

tested in chrome, firefox and ie with web2py source

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to