Reputation: 1244
I am having an issue on my form, is there any way to show separate errors of input array fields. i have fields like this
echo form_label('Name : ','name[]');
echo form_input('name[]',set_value('name[]'));
echo form_error('name[]');
echo '<br>';
echo form_label('Name : ','name[]');
echo form_input('name[]',set_value('name[]'));
echo form_error('name[]');
and in controller, the rules goes like
$this->form_validation->set_rules('name[]','Name','required|min_length[4]');
but form validation library shows same error for both field. If both fields are filled, error vanish and if any one is left blank, error displayed same for both fields, like this "The Name field is required."
Upvotes: 0
Views: 936
Reputation: 4033
You must assign the different names for each control name. and then assign error messages for each controls:
Upvotes: 2