Closed sethsandaru closed 3 years ago
In case that you want to check more carefully (absolutely we shouldn't trust 100% the data from the clients), then, Server-side Validation would be a great addition.
Also, with Server-side Validation, you may check the data in some special specific business logic regarding your applications.
Form Configurations
: enable and add your API Endpointfetch('<API_ENDPOINT', {
data: {
formValues: {/** your form values **/}
}
});
HTTP Status: 422 (Required)
{
"field-name": Array<String>, // fieldName is configured in Vue Form Builder, value should be the error message(s)
}
// example error response
{
"phone": ["Phone must start with +84"],
"quantity": [
"Stock doesn't have enough for this item",
"You can't order more than 10 for this item"
]
}
A Response with HTTP Code 200 would be enough.
@abhimanusharma I have a question regarding the Server-side Validation behaviour. Do you think is it a good idea to show a loading screen while the form doing the XHR request? Or it would be better if the form can disable the button after users pressed it?
@sethsandaru Actually, I use both. I show a loader on the button and make it disable while the response is being retrieving by the XHR request. This gives a clear idea why the button is disabled and what is happening in the application also user can also see when the button is going to enable again, its when the loader will stop loading.
@abhimanusharma That's cool, thanks for sharing!
On going for the last one - Read-only Form.
Features
type='password'
configuration for Text Input controlBugs
Dunno, let's see