Is your goal simply to make sure the user gets redirected to 'index' after 
submitting the form? If that's the case, then you don't have to set a custom 
form action at all. If you leave the form action empty, the form will be 
submitted back to the action that generated it (which is how web2py form 
processing typically works). By specifying the 'next' argument of 
crud.create(), crud will automatically redirect the user to 'index' after a 
successful form submission.

Anthony

On Sunday, October 16, 2011 10:09:04 AM UTC-4, Anthony wrote:
>
> On Sunday, October 16, 2011 3:23:01 AM UTC-4, miroslavgojic wrote:
>>
>> I tray to put mentioned examples into controller after my form definition
>>
>> form['_action'] = URL(index')
>> form.update(_action=URL('index'))
>> form.attributes.update(_action=URL('index'))
>>
>> but it is not happened anything,
>>
> What exactly happened? I assume this does change the form action as 
> expected, but then nothing happens when you submit the form? When you change 
> the form action, the form will get submitted to that action. If you submit 
> the form to 'index', then your 'index' function will have to process the 
> submitted form -- if there's no code in your 'index' function to do so, then 
> nothing will happen. In web2py, forms are typically self-submitting (i.e., 
> submitted to the action that generated them). Is there a reason you want to 
> submit the form to a different action?
>  
>
>> and if I change my value I just get error
>>
>> form.update(_action=my_value) - this make error
>>
> What is my_value? Is it a URL?
>
>  
>
>> In view after beginning of form.custom.start I tray next similar code
>> {{=form['_action'] = URL(index')}}
>>
> I assume you mean form.custom.begin? Anyway, it will not work to change the 
> form action after that because form.custom.begin actually inserts the <form> 
> tag with the action specified -- so changing the action after will not 
> affect the way the form is serialized.
>
> Anthony
>
>

Reply via email to