Rules not validated correctly
Closed this issue · 3 comments
XGhozt commented
I just tried to add creationRules('required')
and it doesn't appear to be working. It turns the fields red if there are also other required fields but I can still submit it with nothing selected without any error.
fourstacks commented
@XGhozt - to be honest I've not really tried this field out with any validation rules yet. Will give that a whirl and see if I can track down where the issue is
batFormat commented
@fourstacks you have not watched it?
ngiraud commented
@XGhozt You can just use a custom clusure rule which will check for a true value in the json like this :
->rules('required', 'json', function($attribute, $value, $fail) {
if (!collect(json_decode($value, true))->containsStrict(true)) {
return $fail('The '.$attribute.' field is invalid.');
}
})