0

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
  • 1
    because the both inputs are same the input name are same set 2 different rules and set the name is different. Commented May 11, 2016 at 5:17

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.