Re: [web2py] Re: It makes duplicate records on datastore
On Saturday, June 25, 2011 8:34:13 PM UTC-4, dorasan wrote: > > Anthony > > Thank you for your reply. > The way to use 'customforms' solved my problem!!! > But adding a hidden _formkey field didn't solve it as it still calls > double submission somehow. > I added a hidden _formkey field like this. > > > > Can you show the code for how you're creating and adding the _formkey value?
Re: [web2py] Re: It makes duplicate records on datastore
Just random... I'm sorry I actually dont understand what _formkey value is.. dorasan 2011/6/26 Anthony > > On Saturday, June 25, 2011 8:34:13 PM UTC-4, dorasan wrote: >> >> Anthony >> >> Thank you for your reply. >> The way to use 'customforms' solved my problem!!! >> But adding a hidden _formkey field didn't solve it as it still calls >> double submission somehow. >> I added a hidden _formkey field like this. >> >> >> >> > > Can you show the code for how you're creating and adding the _formkey > value? > >
Re: [web2py] Re: It makes duplicate records on datastore
When you call form.accepts, the accepts method will create the formkey for you and add it to the session and as an attribute of the form. After calling form.accepts, the key will be stored in form.formkey -- so you could pass that value to the view and insert it as the _formkey field value. I think that would work. I suppose you could also create your own token, but then you'd have to add it to the session yourself, with the name '_formkey[formname]' (you're probably better off letting form.accepts handle it, though). Anthony On Saturday, June 25, 2011 9:38:50 PM UTC-4, dorasan wrote: > Just random... > I'm sorry I actually dont understand what _formkey value is.. > > dorasan > > 2011/6/26 Anthony > >> >> On Saturday, June 25, 2011 8:34:13 PM UTC-4, dorasan wrote: >>> >>> Anthony >>> >>> Thank you for your reply. >>> The way to use 'customforms' solved my problem!!! >>> But adding a hidden _formkey field didn't solve it as it still calls >>> double submission somehow. >>> I added a hidden _formkey field like this. >>> >>> >>> >>> >> >> Can you show the code for how you're creating and adding the _formkey >> value? >> >> > >
Re: [web2py] Re: It makes duplicate records on datastore
On Tuesday, June 28, 2011 11:34:25 AM UTC-4, dorasan wrote: > > Anthony, you are right. My new code does still make duplicate records. > I don't know how come I saw that it prevented a double submission. > > Anyway, the code what you gave me as the best way, prevented a double > submission. It worked. Thank you so much. > I don"t know why submission comes twice on gae but it's great to know for > me how to prevent a double submission. > > As for that the sessions are not locked on gae, it hasn't made any > duplicate record although Ive tried to click the button many times very > quickly. > I suppose you'd have to post twice within milliseconds, so probably not too likely if done manually. Anthony