如果用户为“ registration_type_price”字段输入的值大于“ 0”,我希望“ paying_mb”,“ payment_c”和“ invoice_issuer”字段为必填项。
但是它不起作用,验证消息未显示为“ required_if:registration_type_price,>,0'”。你知道为什么吗?
$rules = [
...
'payment_mb' => 'required_without:payment_c|required_if:registration_type_price,>,0',
'payment_c' => 'required_without:payment_mb|required_if:registration_type_price,>,0',
'invoice_issuer' => 'required_if:registration_type_price,>,0',
];
$customMessages = [
...
'payment_mb.required_if' => 'The field payment methods is mandatory.',
'payment_c.required_if' => 'The field payment methods is mandatory.',
'invoice_issuer.required_if' => 'The field invoice issuer is mandatory..'
];
$this->validate($request, $rules, $customMessages);
答案 0 :(得分:0)
尝试这个
$("#personal_detail_form").validate({
rules: {
full_name: {
lettersonly: true
},phone_number : {
number : true,
minlength:10,
maxlength:10
},city : {
lettersonly : true
},pin_code : {
digits : true,
minlength:6,
maxlength:6
},