Suppose I have 3 fields in the form.
I am writing this code to validate the form.
$rules = array( 'field_1' => 'required', 'field_2' => 'required', 'field_3' => 'required', ); $messages = array( 'field_1.required' => 'Please fill up all value', 'field_2.required' => 'Please fill up all value', 'field_3.required' => 'Please fill up all value', ); $validator = Validator::make(Input::all(), $rules, $messages);
Now, if the user filled out the form 2 fields blank, then the validator will return two error messages. If the user fills in the form 3 fields blank, then the validator returns three error messages. But I want to show only one message for all fields.
source share