open-admin-org / open-admin

open-admin forked from z-song/laravel-ladmin. Removing jquery, now based on Bootstrap5, vanilla JS
https://open-admin.org
MIT License
259 stars 75 forks source link

Display Error message on form submit for required fields #155

Open AndreasMySch opened 9 months ago

AndreasMySch commented 9 months ago

Is there a default "display error on form() submit" method that I can use? Or should this be built in manually? I have added "->required()" to the form fields in my form() function to show the required asterisk "*". At the moment, when leaving the field marked "required()" empty and trying to submit only this shows in the console "Form still has errors" from the open-admin-form.js file.

RCyrix commented 9 months ago

You can use a hook to provide custom validation and a response you can set validation rules

Please refer to the documentation regarding Form callback and Form validation