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
I am using global validation rules: required_unless:0|max:255
I notice in my custom validator it doesnt get called though when the input is blank. (Im using indexes for target as the inputs dont have specific names)
Im using v4 and i cant seem to find this in the docs anywhere
defineRule('required_unless',(value,[targetIndex],ctx)=>{if(isEmpty(value))returntrue;constmap=Object.entries(ctx.form).reduce((acc,[k,v])=>{constinputIndex=k.split('_')[2];acc[inputIndex]=v;returnacc;},{});consttargetValue=map[targetIndex];if(isEmpty(value)&&isEmpty(targetValue))return'Please fill in this field';returntrue;});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using global validation rules:
required_unless:0|max:255
I notice in my custom validator it doesnt get called though when the input is blank. (Im using indexes for target as the inputs dont have specific names)
Im using v4 and i cant seem to find this in the docs anywhere
Beta Was this translation helpful? Give feedback.
All reactions