Hi Anthony,
the form.process(session=None) solution solved my submit button Problem!

What do you mean with bei -The code isn't quit right-. 
I don't have get_countries as a component inside print_countries as far as 
i know. 
Do i have to make a view file for the get_countries function?
I am new to web2py and web programing (after years of developing Desktop 
database applications) so i need examples or more Information.
Where do i put the LOAD(..., ajax=True and what is the procedure behind the 
seen? Please give me an example.

You have been very helpful, thank you.

Karl

Am Montag, 9. November 2015 13:25:46 UTC+1 schrieb Anthony:

> On Monday, November 9, 2015 at 3:16:46 AM UTC-5, Karl Florian wrote:
>>
>> Thank you for your very good suggestions.
>> Here is what i tried:
>> Putting the script into my print_countries view worked good.
>> The only Thing that bothered me was that i had to click the submit Button 
>> twice.
>>
>
> I see the problem. You only have to click submit once the first time. But 
> because submission does not cause the page to reload, you're stuck with the 
> same CSRF token in the form, so when you attempt to submit a second time, 
> the CSRF check fails, and instead you get a new page with a fresh form (and 
> fresh CSRF token) -- and then the next submsit works. If you don't need 
> CSRF protection for this form (which you may not, given that it doesn't 
> appear to be inserting anything to the database but only requesting 
> information), you can disable it via form.process(session=None). Or you can 
> implement your own CSRF protection with a multi-use token.
>  
>
>> The Problems i had using your alternative solution are best explained in 
>> my attachment.
>>
>
> The code isn't quite right. You have get_countries as a component inside 
> print_countries. Instead, print_countries should be an Ajax component 
> inside a parent page (i.e., you'll have to create a new parent page whose 
> only content is the print_countries component). Then get_countries is 
> called via the Javascript returned by print_countries.
>
> Anthony
>

-- 
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/d/optout.

Reply via email to