Laravel:
$validatedData = $request->validate
([
'name'=> ['required', 'regex:^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,()]+$^'],
]);
([
'name'=> ['required', 'regex:^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,()]+$^'],
]);
Jquery
<script>
// Basic Example with formvar form = $("#example-form");
form.validate({
errorPlacement: function errorPlacement(error, element) { element.after(error); },
rules: {
first_name:{
required:true,
minlength:2,
maxlength:100,
regex:/^[a-zA-z ]+$/,
},
last_name:{
required:true,
minlength:2,
maxlength:100,
regex:/^[a-zA-z ]+$/,
},
email:{
required:true,
email:true
},
address:{
minlength:2,
maxlength:500,
regex:/^[a-zA-z,-/_=. #]+$/,
},
shipping_days:{
required:true,
digits:true,
min:1,
max:90
},
return_days:{
required:true,
digits:true,
min:1,
max:90
},
},
last_name:{
first_name:{
regex:"*First name can only consist letters"
},
first_name:{
regex:"*First name can only consist letters"
}
}
});
</script>
0 comments:
Post a Comment
Thanks