Skip to content
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

Use of the new validationRules on repeatable and relation is not documented #321

Open
Polfo opened this issue Feb 16, 2022 · 1 comment
Open

Comments

@Polfo
Copy link
Contributor

Polfo commented Feb 16, 2022

A nice new feature is the validationRules attribute for a field now, but how do we apply this to a repeatable field or a relation?

@Polfo
Copy link
Contributor Author

Polfo commented Feb 16, 2022

Something like this works for repeatable, but please hint how to do this for relation.

CRUD::addFields($fields); // $fields includes `validationRules` for non-repeated fields
CRUD::setValidation();
CRUD::setOperationSetting('validationRules', CRUD::getOperationSetting('validationRules') + [
    'songs.*.name' => 'required',
    'songs.*.info' => 'required',
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant