Closed rajasekar-d closed 7 years ago
If the fields are optional, then you need to add the 'nullable' rule. 'Sometimes' means that the other validation rules will be run if the array of parameters includes said field. Since you're passing
"facebook_url":"",
"google_plus_url":"",
"twitter_url":"",
"linkedin_url":"",
then these fields are indeed present, therefore the other validation rules will be run. If the field is optional, add 'nullable':
'facebook_url' => 'sometimes|regex:/http(s)?:\/\/(www\.)?facebook\.com\/.+/i|nullable'
@devcircus Works like a charm :+1:
Description:
Optional input field validation issue. I mentioned website & facebook_url, google_plus_url, twitter_url, linkedin_url as optional field even though i'm getting the validation error while submitting via ajax.
Payload:
Rules:
Validation Response: