Did you leave out some code, because the code you have shown for 
sale_order_checkout includes no form nor any writing to the session?

The idea of the dummy data is just to write some nonsense data to the 
session in the *parent* function:

def sale_order():
    session.dummy = 'dummy data'
    ...

That will force a session file to be created when the parent page is 
loaded. Once a session file exists, it will be locked by each Ajax request, 
so there will be no race condition caused by the simultaneous Ajax requests.

Note, if this is the problem, it should only appear when you are starting a 
new session. Once you have visited a page that saves to the session and a 
session file has been created, there should be no subsequent problems 
during the same session. If you observe the same problem happening 
repeatedly during the same session, then something else is going on.

Anthony

On Monday, July 13, 2015 at 5:20:00 PM UTC-4, 黄祥 wrote:
>
> hm, sorry, when i open in google groups it appears in web2py-users but in 
> gmail i received it from web2py-developers. k, back to the problems. in 
> web2py-users first report said :
>
> If the form has errors, the error messages are displayed after a 
> second submit. So, I need to click two times the submit button to 
> display them.
>
> the condition i face is : i have 2 components, first is form to fill the 
> product in session (SQLFORM.factory), the second is the checkout which is 
> again have a form that have a function to modify the session via ajax 
> callback.
>
> the problem is : if the form has errors the error messages are displayed 
> after a second submit, same for if the form is accepted, the data in form 
> are save in session after a second submit, so, i need to click submit two 
> times.
>
> for session i have it on files not in database, and for dummy data, i'm 
> not sure i'm getting it, because it's the order, i can't create the dummy 
> data in the session, cause it can affect the total price. still about 
> session, already check with response.toolbar() seems that the first time i 
> land it is there with no value
> e.g.
> sale_order:
>
>
> after second submit
> sale_order:
> 1:
> 2
> 20000
>
> any idea why the form in first component must submit twice to response 
> either error or accepted?
>
> thanks and 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to