Hi Anthony, Thanks for your note. Like I said, I understand the helpful comments on fixing the <button onclick...> issue.
However, what is unclear to me still is Massimo's (and yours here - https://groups.google.com/forum/?fromgroups#!searchin/web2py/custom$20form$20jquery/web2py/7Meea7Ul0o8/4ZdrD9hP5MEJ ) comments on form processing.. Massimo pointed out that, a la Jonas' post, that you cannot do - form=crud.create(db.comments) if form.process().accepted ...yet I have: form = SQLFORM.factory(*fields) if form.accepts(request, session): ...and that also seems to be wrong (no doubt, since process() is a shortcut for accepts(), they are doing the same thing). BUT I am not sure how to correct it - you both said that process is getting called twice. OK, if I shouldn't use 'if form.accepts(request, session): ' then what should I use to process (and call validation on) the form once the user clicks 'Submit' ? Thanks again, -jl On Friday, September 27, 2013 7:36:04 PM UTC-7, Anthony wrote: > > If you follow Massimo's suggestion: > > <button onclick="event.preventDefault();window.location='{{=URL('index > ')}}'">Cancel</button> > > everything seems to work fine. What problem do you have after making that > change? > > Anthony > > On Friday, September 27, 2013 9:00:47 PM UTC-4, Jordan Ladora wrote: >> >> Hi Massimo, >> >> Thanks for your help. I think I'm crystal clear on your explanation >> regarding the button, but I'm still confused on the other issue that >> Anthony answered previously, despite his and your posts.. >> >> In my controller I used: >> >> form = SQLFORM.factory(*fields) >> >> if form.accepts(request, session): >> >> >> Could you please be a little more specific? What should I use here >> instead of 'form.accepts' ? I think this is causing me trouble elsewhere in >> my application, too, and it would be really helpful if I knew a little bit >> more.. >> >> Thanks again, >> -J >> >> >> >> On Tuesday, September 17, 2013 12:15:01 PM UTC-7, Jordan Ladora wrote: >>> >>> Hi, >>> >>> I have the same problem as >>> >>> >>> https://groups.google.com/forum/?fromgroups#!searchin/web2py/custom$20form$20jquery/web2py/7Meea7Ul0o8/4ZdrD9hP5MEJ >>> >>> https://groups.google.com/forum/?fromgroups#!searchin/web2py/custom$20form$20jquery/web2py/E9RyEqh01RQ/6duW4RmALvcJ >>> >>> From the first thread/link above, "...if I use a regular form, >>> {{=form}}, then validation works but not if I use the custom form. Also >>> form.process() works, so the problem seems to be related to custom forms.." >>> >>> Those threads seemed to end without finding a solution. I think the >>> author of those threads didn't realize that the form is actually being >>> validated, but it doesn't seem like it b/c the error messages do not show >>> with the custom form. >>> >>> In my hands, if I use a custom form, it validates OK but form errors do >>> not display and, quite often, any jquery code in the view misbehaves (which >>> is the real problem). This behavior turns on and off depending ONLY on >>> whether I have a custom form. I used {{=custom.form.begin}} and >>> {{=custom.form.end}} and {{=form.custom.widget.xyz}} and >>> {{=form.custom.label.xyz}} in the view. If I replace it with {{=form}} then >>> everything works perfectly. >>> >>> In the controller, I used >>> >>> if form.accepts(request, session, onvalidation=abc): >>> ... >>> >>> >>> Thanks for any help. I love the custom forms and it really stinks not >>> being able to use them with jQuery!! >>> >>> -jl >>> >>> ps - I previously posted with more details about this problem, before I >>> realized the problem seems related more generally to javascript/jquery + >>> custom forms - >>> >>> https://groups.google.com/forum/?fromgroups=#!topic/web2py/rPHKPqqHbsg >>> https://groups.google.com/forum/?fromgroups=#!topic/web2py/0LpfMJPwSsI >>> >>> >>> -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

