-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form validation and submit flow #55
Comments
Form submission dataBy default the The In SPA pattern, the form submit leads to http request by code and URL handling by routing mechanism on successful ajax completion. The transitioning state usually freeze the form to avoid the double submission and displayin the progress state as wording and animation. In the |
expose native error data from browser API
The event data would remain on field/form associated slise till relevant to the slice elements event occur. |
|
data in form lifecycleFilled before
The use of native validity capabilities is more accessible and device optimized than custom UI. See the form use example how to build UX by extending the validity instead of explicit error logic and UI control. |
#23 defines slice relation |
Form validation flow
Each form field on
change
can trigger either native ( by element implementation ) or DCE event-driven declarative "validation", i.e. DOM change according to input validity.Alternatively, the "change" event is propagated from form inputs to the form element itself.
This is a natural choice for validation trigger on the form level and propagate the
formData
whenslice
is defined on the form element.would use
new FormData(formElement)
asvalue
for the form. The serializer should encode the<form-data>
XML to be passed tohttp-request
component.In the given example the password input would appear matching radio selection. During the selection change, the
/datadom/slice/signin-form/form-data/confirm-by
or simply//form-data/confirm-by
if filled by the form change event handler.custom-validity
attributeThe DOM changes are not the usual outcome of validation. HTML5 has dedicated styling and special properties associated with form input elements.
The input form element has several read-only properties and methods
available:
validationMessage
,validity
, etc. To set the validity the only available method issetCustomValidity(message)
.custom-validity
attribute would set the message as an XPath expression by API ^^. It would require an extra post-render step with traversing of whole DOM or altering theDOM + rendered template merging
algorithm.Q. How to allow the default validity values along with custom ones?
Setting custom validity to blank would(?) eliminate the defaults. Setting to the particular value would override default ones also.
Wish: expose the
validity
form field property of ValidityState type.Perhaps as part of the event source element on the
slice
.should-submit
form attribute for the form submit preventionshould-submit
attribute would evaluate its value as XPath expression. The value would besubmit
event.Usually the form level validation is triggered by form submission flow.
The `change` event is available on the `FORM` element
The boolean
false
value of XPath fromshould-submit
can serve the indicator of error without the form level message. The UI should check this value from the form event slice and hide the message forfalse
case, otherwise display the message.The text was updated successfully, but these errors were encountered: