Please send the full controller and view code (or minimal code that 
replicates the problem).

On Sunday, August 28, 2011 7:06:40 PM UTC-4, apple wrote:
>
> 1.98.2 
>
> I have narrowed the problem down to the crud.update call. I do three 
> submits with the same data to this controller: 
>
>     print("RRRRRR",request.vars) 
>     print("SSSSSS",session['_formkey[customer/1]']) 
>     form=crud.update(table, a.id, onaccept=onaccept) 
>     print("TTTTTT",session['_formkey[customer/1]']) 
>
> The first submit shows formkey 708 in request and session; onaccept is 
> called; and session formkey is still 708. 
>
> The second submit with identical data shows formkey 708 in request and 
> session; onaccept is NOT called; and session formkey comes out as 154. 
>
> The third submit with identical data shows formkey 154 in request and 
> session; onaccept is called; and session formkey is still 154. 
>
> On Aug 28, 10:51 pm, Anthony <[email protected]> wrote: 
> > What version of web2py? Can you show more of your controller and view 
> code? 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Sunday, August 28, 2011 3:28:10 PM UTC-4, apple wrote: 
> > 
> > > On further investigation this is not a database problem. The reason 
> > > for the failed update is that the formkey is the same on the first/ 
> > > second submission and third/fourth submission etc.. 
> > 
> > > The first time the form is generated is using LOAD with ajax=false. 
> > > The subsequent submits are via ajax. 
> > 
> > > What would cause the formkey to be the same? There is a long pause and 
> > > some typing between the two submits so it is not an accidental double 
> > > click. 
> > 
> > > On Aug 28, 8:18 pm, apple <[email protected]> wrote: 
> > > > If the database fails to update within CRUD is there a way I can view 
>
> > > > the error? 
> > 
> > > > I have a controller with this code that works fine: 
> > > >        form=SQLFORM(table,a.id) 
> > > >        if form.accepts(request.vars, session): 
> > > >            response.flash="record updated" 
> > 
> > > > I replace it with: 
> > > >       form=crud.update(table, a.id) 
> > 
> > > > Now it works fine the first time the form is changed. Then the second 
>
> > > > time it correctly calls the controller but the database is not 
> updated 
> > > > and the form reverts to the pre-change values. This continues so on 
> > > > odd submits it works and even submits it does not. 
> > 
> > > > It also seems to work on all submits when I excluded certain fields. 
> I 
> > > > am thinking maybe there is a database error thrown inside CRUD but no 
>
> > > > error message is logged.

Reply via email to