Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping me
find a workaround.

And many thanks to Josh Canfield who can point directly about mistake in my
code. Yep, it's because my submit don't have id.

So the conclusion is: If we want to use "cancel" mode submit, then we should
give an id to the submit component.
"cancel" mode is working after I change my template code to this:
<t:form t:id="form">
        <t:textfield t:id="testField" t:value="testField"
t:validate="required" />
        <t:submit t:id="normalSubmit" value="normal submit"/>
        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel submit"/>
</t:form>

Thanks a lot for your help, guys..
You save my time a lot..


On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <joshcanfi...@gmail.com>wrote:

> I believe the problem is that the id of your submit button is "submit"
> which
> overrides the form. submit() of the form. Try adding t:id="something" to
> your submit button.
>
> I thought this was fixed, but just team into it myself last week.
> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yohan.yudan...@gmail.com> wrote:
> > Hi..
> >
> > I want to use submit button which can bypass client validation.
> > Having read this documentation:
> >
>
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
> ,
> > I was trying to use Submit component with mode="cancel" like this:
> >
> > <t:form t:id="form">
> > <t:textfield t:id="testField" t:value="testField"
> > t:validate="required" />
> > <t:submit value="normal submit"/>
> > <t:submit mode="cancel" value="cancel submit"/>
> > </t:form>
> >
> > But, when I click "cancel submit", nothing happen (form is not submitted
> to
> > server).
> > If I click "normal submit" after "cancel submit", the form is submitted
> to
> > server without client validation.
> >
> > Why do I should click two buttons ( "cancel" and then "normal" submit) to
> > bypass client validation?
> > Is it a bug?
> > "Cancel submit" supposed to directly submit form to server, isn't it?
> > Is there a simple workaround for this?
> >
> > Thanks in advance,
> >
> > Best regards,
> > Yohan Yudanara
>

Reply via email to