This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I am creating a custom plugin with backend form for a client. I need to validate the form fields, but cannot figure out how. I followed the model validation documentation by adding a $rules array to my model. Yet when I click save on my /create route it attempts to save in the db without throwing validation errors. Does FormController not do form validation? Do I need to override the default behavior for create/update? Thanks
Last updated
Thanks again @Flynsarmy. It works!
I'm a little new to traits, and previously I had try to add the use
line outside of the class, but got an exception.
Last updated
Use it inside of the class. Like this
public Class
{
use \October\Rain\Database\Traits\Validation;
}
Last updated
And how to add custom validation messages in here? I've tried to add them in a $messages property, but it doesn't seem to be used.
1-6 of 6