You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Bob Harner <bo...@gmail.com> on 2016/04/02 23:56:04 UTC

Submit mode="cancel" only skips client-side validation, not server-side

Everybody,

That mode="cancel" parameter of the Submit component really irritates
me. It only skips client-side validation, not server-side validation.
Would anybody object if I changed that?

Howard actually started making this change as TAP5-1604 many years ago
but reversed himself because skipping server-side validation would be
a backward incompatibility. But I wonder if that's really true except
in rare cases.

I think when most users try the mode="cancel" parameter they are
surprised to find that it doesn't bypass server-side validation, and
their eventual response is to add junk code like this:

boolean wasCanceled;
void onCanceled() {
    wasCanceled = true;
}
void onValidateFromForm() {
    if (wasCanceled) {
        return;
    }
    [perform server-side validation]
}

My proposed 3-line change to Form.java would not break code like the
above, and would make such checks unneccessary. And all current
Tapestry tests pass cleanly (which admittedly just means that this
scenario is not well covered by tests).

References:
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/SubmitMode.html
https://issues.apache.org/jira/browse/TAP5-1604
https://issues.apache.org/jira/browse/TAP5-1856
https://issues.apache.org/jira/browse/TAP5-1503
https://issues.apache.org/jira/browse/TAP5-1451
https://issues.apache.org/jira/browse/TAP5-86

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Submit mode="cancel" only skips client-side validation, not server-side

Posted by Jochen Kemnade <jo...@eddyson.de>.
Hi,

I think that's a good idea, Bob. However I suggest we make this change 
for 5.5 only.

Am 02.04.2016 um 23:58 schrieb Dimitris Zenios:
> A symbol for that disabling that functionality and keeping backwards
> compatibility would be nice.

That could be a way to introduce it in 5.4.x. We can still change the 
symbol default in 5.5.

Jochen

>
> On Sun, Apr 3, 2016 at 12:56 AM, Bob Harner <bo...@gmail.com> wrote:
>
>> Everybody,
>>
>> That mode="cancel" parameter of the Submit component really irritates
>> me. It only skips client-side validation, not server-side validation.
>> Would anybody object if I changed that?
>>
>> Howard actually started making this change as TAP5-1604 many years ago
>> but reversed himself because skipping server-side validation would be
>> a backward incompatibility. But I wonder if that's really true except
>> in rare cases.
>>
>> I think when most users try the mode="cancel" parameter they are
>> surprised to find that it doesn't bypass server-side validation, and
>> their eventual response is to add junk code like this:
>>
>> boolean wasCanceled;
>> void onCanceled() {
>>      wasCanceled = true;
>> }
>> void onValidateFromForm() {
>>      if (wasCanceled) {
>>          return;
>>      }
>>      [perform server-side validation]
>> }
>>
>> My proposed 3-line change to Form.java would not break code like the
>> above, and would make such checks unneccessary. And all current
>> Tapestry tests pass cleanly (which admittedly just means that this
>> scenario is not well covered by tests).
>>
>> References:
>>
>> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>>
>> http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/SubmitMode.html
>> https://issues.apache.org/jira/browse/TAP5-1604
>> https://issues.apache.org/jira/browse/TAP5-1856
>> https://issues.apache.org/jira/browse/TAP5-1503
>> https://issues.apache.org/jira/browse/TAP5-1451
>> https://issues.apache.org/jira/browse/TAP5-86
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Submit mode="cancel" only skips client-side validation, not server-side

Posted by Dimitris Zenios <di...@gmail.com>.
A symbol for that disabling that functionality and keeping backwards
compatibility would be nice.

On Sun, Apr 3, 2016 at 12:56 AM, Bob Harner <bo...@gmail.com> wrote:

> Everybody,
>
> That mode="cancel" parameter of the Submit component really irritates
> me. It only skips client-side validation, not server-side validation.
> Would anybody object if I changed that?
>
> Howard actually started making this change as TAP5-1604 many years ago
> but reversed himself because skipping server-side validation would be
> a backward incompatibility. But I wonder if that's really true except
> in rare cases.
>
> I think when most users try the mode="cancel" parameter they are
> surprised to find that it doesn't bypass server-side validation, and
> their eventual response is to add junk code like this:
>
> boolean wasCanceled;
> void onCanceled() {
>     wasCanceled = true;
> }
> void onValidateFromForm() {
>     if (wasCanceled) {
>         return;
>     }
>     [perform server-side validation]
> }
>
> My proposed 3-line change to Form.java would not break code like the
> above, and would make such checks unneccessary. And all current
> Tapestry tests pass cleanly (which admittedly just means that this
> scenario is not well covered by tests).
>
> References:
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Submit.html
>
> http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/SubmitMode.html
> https://issues.apache.org/jira/browse/TAP5-1604
> https://issues.apache.org/jira/browse/TAP5-1856
> https://issues.apache.org/jira/browse/TAP5-1503
> https://issues.apache.org/jira/browse/TAP5-1451
> https://issues.apache.org/jira/browse/TAP5-86
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>