0
votes

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."

1
because the both inputs are same the input name are same set 2 different rules and set the name is different. - Yaseen Ahmad

1 Answers

2
votes

You must assign the different names for each control name. and then assign error messages for each controls: