You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The admin server settings view should have validation implemented when submitting the form.
For this behavior, I might suggest different scenarios:
Basic Form Validation: Single error message "Form validation failed" displayed in a fade box.
Pros and Cons:
Pros
Cons
Simple implementation.
Does not provide detailed feedback on errors.
Easy to understand for users.
Users may need to guess which fields need correction.
Enhanced Form Validation: Error messages are shown for each field after submission. The error message would appear either when hovering over an icon or displayed directly under the failed fields (Note: current display is for demo purposes).
Pros and Cons:
Pros
Cons
Provides clear, field-specific feedback.
More complex to implement compared to basic validation.
Users can easily identify and correct errors in specific fields.
May require additional design considerations for displaying error messages.
Dynamic Form Validation: Errors are displayed live using Validate.js (which is the option I used in one of my own not finished Ogame clone).
After declaring rules in a file, simple example:
<?php$createUniverseRules = [
'universe_name' => [
'required' => true,
'pattern' => ['^[a-zA-Z0-9\s\-]+$', 'i', 'Please enter only letters, numbers, spaces, and dashes.'],
'minlength' => 3
],
<truncated>
];
foreach ($createUniverseRulesas &$rule) {
if (isset($rule['pattern'])) {
$rule['pattern'] = base64_encode(json_encode($rule['pattern']));
}
}
return$createUniverseRules;
In addition, I developed a utility wrapper which was able to validate any form with rule files:
Thanks for the extensive proposals! Personally I am most fond of option 3 "Dynamic form validation".
I like the idea of having a generic utility wrapper that can be used for multiple forms in both admin backend and user frontend.
I am wondering a little bit though how the scenario you described would compare to the default Laravel form validation provided by the framework: https://laravel.com/docs/11.x/validation.
I haven't put any meaningful effort into form validation yet so I don't fully know what the pros/cons and abilities are of the default Laravel form validation. But perhaps some features are already built-in making it possible to utilize native methods in combination with e.g. Validator.js. Might be worth looking into.
The admin server settings view should have validation implemented when submitting the form.
For this behavior, I might suggest different scenarios:
Basic Form Validation: Single error message "Form validation failed" displayed in a fade box.
Pros and Cons:
Enhanced Form Validation: Error messages are shown for each field after submission. The error message would appear either when hovering over an icon or displayed directly under the failed fields (Note: current display is for demo purposes).
Pros and Cons:
Dynamic Form Validation: Errors are displayed live using Validate.js (which is the option I used in one of my own not finished Ogame clone).
After declaring rules in a file, simple example:
In addition, I developed a utility wrapper which was able to validate any form with rule files:
In the overlay, you can provide these rules to the blade template and directly use them with validate.js.
Pros and Cons:
Feel free to share any idees
The text was updated successfully, but these errors were encountered: