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
public function rules()
{
return [
[['status'],raoul2000\workflow\validation\WorkflowValidator::className()],
[['published_date'],'required',
'on' => 'enter status {post/published}'],
];
}
When I change to status=published I require published_date.
However once it's in published, there is no validation unless the status changes again.
It would be nice if I could say published_date was required if status=published (or if the status is in a given list). Is there any easy way to do this without making a custom validator?
The text was updated successfully, but these errors were encountered:
cornernote
changed the title
validation
validation when not changing status
Feb 15, 2017
Hi @cornernote,
as you have understood, the WorkflowValidator validator only perform validation on status change and right now, only a custom validator could do what you describe
yes that's an option. Another option could be to create a reflexive transition from {post/published} ot itself. This way, when the model is saved and the status does not change, yii2-workflow will assume it is dealing this transition and perform configured validation.
When I change to
status=published
I requirepublished_date
.However once it's in published, there is no validation unless the status changes again.
It would be nice if I could say
published_date
was required ifstatus=published
(or if the status is in a given list). Is there any easy way to do this without making a custom validator?The text was updated successfully, but these errors were encountered: