Actually the problem you have is different. The links you refer to both had
the same problem and it was addressed by Anthony in his post. You cannot do:
form=crud.create(db.comments)
if form.process().accepted
because crud.create already calls process() internally, you it was called
twice.
You problem is different. You have a button inside a form and if you click
it, it will submit the form. Unless you tell it not to:
<button
onclick="event.preventDefault();window.location='{{=URL('index')}}'">Cancel</button>
On Thursday, 26 September 2013 14:44:49 UTC-5, Jordan Ladora wrote:
>
> Hello again,
>
> I've attached an app with the problem I have.. if you click on the button
> and go to 'debug_js' view, you'll see that hitting the 'cancel' button
> there causes a POST request, form reload, and validation. This is par for
> the problems I've been having with custom forms.. if you move that button
> outside the custom form, everything behaves normally..
>
> Thanks again for help with this!
> -jl
>
>
>
> On Fri, Sep 20, 2013 at 2:39 PM, Marin Pranjić
> <[email protected]<javascript:>
> > wrote:
>
>> Can you pack a minimal application that reproduces this?
>>
>>
>> On Fri, Sep 20, 2013 at 11:18 PM, Jordan Ladora
>> <[email protected]<javascript:>
>> > wrote:
>>
>>> Ahhhhhhh f*ck it, then...
>>>
>>>
>>>
>>>
>>> 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/7Meea7Ul0o8/4ZdrD9hP5MEJ>
>>>> https://groups.google.com/**forum/?fromgroups#!searchin/**
>>>> web2py/custom$20form$20jquery/**web2py/E9RyEqh01RQ/**6duW4RmALvcJ<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/rPHKPqqHbsg>
>>>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>>>> web2py/0LpfMJPwSsI<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] <javascript:>.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/rHwdHamBjHI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
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.