Patternslib / Patterns

Library for quickly applying rich interaction patterns without the need to write any JavaScript.
http://patternslib.com
Other
104 stars 43 forks source link

pat-validation: Allow submission for formnovalidate buttons #960

Closed thet closed 2 years ago

thet commented 2 years ago

In Plone all action buttons are submit buttons, including the cancel button. We're going to add a formnovalidate attribute in plone.app.z3cform to those buttons which should skip the validation, like the cancel button, See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate

We need to make sure that pat-validation respects the formnovalidate attribute and allows the form to be submitted without validation.

cornae commented 2 years ago

A cancel button should in the vast majority of cases no be submit button.

Op 11 feb. 2022, om 09:28 heeft Johannes Raggam @.***> het volgende geschreven:

In Plone all action buttons are submit buttons, including the cancel button. We're going to add a formnovalidate attribute in plone.app.z3cform to those buttons which should skip the validation, like the cancel button, See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate We need to make sure that pat-validation respects the formnovalidate attribute and allows the form to be submitted without validation.

— Reply to this email directly, view it on GitHub https://github.com/Patternslib/Patterns/issues/960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFUKKIJWBKTULUK2OXOZMLU2TCCFANCNFSM5ODPWFRA. You are receiving this because you are subscribed to this thread.

thet commented 2 years ago

I agree. There are cases where it might needed - for example if the cancel button modifies the server state. In Plone we have a locking mechanism - when someone edits a document the document is locked so that others cannot modify it. When hitting "cancel" the lock has to be released. I think that is the reason why the cancel button is a submit button in default Plone.

thet commented 2 years ago

Fixed with https://github.com/Patternslib/Patterns/pull/966/commits/35f4227227b4acdfe5f202b7d5d996724081beec from: https://github.com/Patternslib/Patterns/pull/966