The form won't get submitted to the org_form_load action, but instead will 
get submitted to the action of the parent page. You have to trap the form 
submission and submit back to the org_form_load action. Rather than using 
the ajax() function to load a form, you're better off loading the form via 
an Ajax component:

onkeyup="{{="$.web2py.component('%s', 'org_form_target');" % URL('default', 
'org_form_load.load')}}"

Anthony

On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:
>
> Thanks,
> It solved the error getting after the form is loaded into the page,
> but still nothing happen if I submit the form.
> This is what I do:
> if form.process().accepted:
>             response.flash = 'Success!'
> elif form.errors:
>             response.flash = 'response errors'
>
>
> On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:
>>
>> The form is not accepted when it is first created, so you will always get 
>> that error message. Instead, you want:
>>
>>     elif form.errors:
>>         response.flash = 'There was an error..'
>>
>> Anthony
>>
>> On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:
>>>
>>> Hi,
>>> I have this on the view:
>>>
>>> <div>
>>>    <input name="name" onkeyup="ajax('org_form_load.load', ['name'], 
>>> 'org_form_target')" />
>>> </div>
>>> <div id = "org_form_target"></div>
>>>
>>> and something like this on the controller:
>>>
>>> def org_form_load():
>>>     org_code = request.vars.name
>>>     org_code_name = db(......).select(..............)
>>>     if org_code_name:
>>>         db.t_org_members.f_org_member.default = auth.user.id
>>>         form = 
>>> SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
>>> 'something.......')
>>>         if form.process().accepted:
>>>             response.flash = 'Success!'
>>>         else:
>>>             response.flash = 'There was an error..'
>>>         return dict(form = form, org_code_name = org_code_name)
>>> and on the org_form_load:
>>>
>>> {{=form}}
>>>
>>>
>>>
>>> (Before moving the form into the load page, everything went fine.)
>>> After moving the form to the load page, this is what it does:
>>> User fill correctly the organization code.
>>> The form appears as expected, (but not submitted yet)
>>> BUT I already get the " response.flash = 'There was an error..'".
>>> If I try to submit the form nothing flashes and form is not submitted 
>>> either.
>>> Help please...
>>> Thanks.
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to