Construct a validator with a list of rules the same size of your input.
for($i = 0; $i <= count(porcentaje); $i++){
$rules['porcentaje.' . $i] = 'required|numeric|between:0,100';
}
$validator = Validator::make($porcentaje, $rules);
Not sure if I understand the question correctly.
To show custom message, http://laravel.com/docs/validation#custom-error-messages
$customMessages = array(
'customer_name.required' => 'Hey, you forgot to put your name! '
);
$rules = array(
'customer_name' => 'required'
);
$validation = Validator::make($data, $rules, $customMessages);
// If your html input is an array, hence <input type="text" name="customer[name]" />,
// you will do this.
$rules = array(
'customer.name' => 'required',
);
$customMessages = array(
'customer.name.required' => 'Hey you forgot to put in your name !!',
);
$validation = Validator::make($data, $rules, $customMessages);
To add custom message for each of you fields its the same thing :
for($i = 0; $i <= count(porcentaje); $i++){
$rules['porcentaje.' . $i] = 'required|numeric|between:0,100';
$messages['porcentaje.' . $i] = 'porcentaje invalid';
}
$validator = Validator::make($porcentaje, $rules, $messages);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community