Welcome Guest, Not a member yet? Register   Sign In
Form Validation issue or customization required....
#1

[eluser]Unknown[/eluser]
If there is array of form fields so validation in such a case should show an error msg for individual fields which is not happening currently. i found many codes here and there but none of them worked so posting this msg..
An example to what i require or wht i m trying to do...

Code:
<?php
// view page to contain the form fields
  echo form_input('name[]');
  echo form_input('gender[]');
  echo form_input('age[]');
  echo form_input('relation_with_student[]');
// controller to validate the fields
  $this->form_validation->set_rules('name[]', 'Name', 'required');
  $this->form_validation->set_rules('gender[]', 'Gender', 'required');
  $this->form_validation->set_rules('age[]', 'Age', 'required');
  $this->form_validation->set_rules('relation_with_student[]', 'Relation', 'required');
// displaying the validation error string
  echo validation_errors();
// Output of error message
  Name field is required
  Age field is required
  ....
?>
In the above code if there are two set of all the fields:
Case : if from one of the set name fields is left empty but the name from the other set is filled with some value the error message is still there saying "Name field is required"
but for which set of the name field is the error for is unknown. is there any such thing as a facility in codeigniter, have i missed anything. plzzzz let me know.... i need an urgent help..

Thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB