• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Setting Error Message For Form

#1
[eluser]Swayam[/eluser]
Dear All,

Please help me with this..i am new in codeigniter..i have a registration form where i have 7 fields ..i m validating all the fields with set_rules...but when user press submit without entering information..it shows field is required individually ..i want a single message if all the fields left blank..
Code:
$this->form_validation->set_rules('uname','Username','required|min_length[5]|max_length[12]');
  $this->form_validation->set_rules('pass','Password','required');
  $this->form_validation->set_rules('fname','Full Name','required');
  $this->form_validation->set_rules('emailid','Email id','required|valid_email');
  $this->form_validation->set_rules('address','Address','required');
  $this->form_validation->set_rules('city','City','required');
  $this->form_validation->set_rules('contact','Contact No.','required');
  $this->form_validation->set_message('required',"Error Message");
  
  if($this->form_validation->run() == FALSE)
  {
   $data['error_message'] = validation_errors();
   $this->load->view("registration",$data);
  }
  else
  {
                  echo "valid";
                }
..how can we do this..??


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.