Yay! I'm happy I'm not the only one who's noticed this!

[T5.3-beta-1] Submit buttons with t:mode="cancel" do not submit the form
http://tapestry.markmail.org/message/5yrkjtm2nfevear5

I to, would like someone in the know to confirm whether this is
desired behaviour (I'm thinking it's not, but then again, I'm also
pretty stoopid).

But, err, I don't know what the workaround is.

For those who want the "Canceled" event to fire in T5.3, remove the
t:mode="cancel" attribute (so the form submits!), ensure your cancel
button has t:id="cancel" and add the following to your Module:

public static void
contributeFactoryDefaults(MappedConfiguration<String, Object>
configuration) {
        // remove "cancel" from the list of reserved names
        configuration.override(InternalSymbols.PRE_SELECTED_FORM_NAMES,
"reset,submit,select,id,method,action,onsubmit");
}

The downside being you can now only have one Cancel button per form
and, as in T5.2.6, you either have to turn off client side validation
for the whole form:

<t:form t:clientValidation="false" ...

or for the whole application:

public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
configuration) {
        configuration.add(SymbolConstants.FORM_CLIENT_LOGIC_ENABLED, "false");
}

Steve.


On 6 September 2011 12:15, Yohan Yudanara <yohan.yudan...@gmail.com> wrote:
> oo sorry, I forgot to mention.
> I'm using Tapestry 5.2.6
>
> On Tue, Sep 6, 2011 at 11:13 AM, 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
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to