Welcome Guest, Not a member yet? Register   Sign In
Validation error message is missing the field name
#5

[eluser]gtech[/eluser]
OK I have an answer but not sure you will like it :-(

When using set fields the $fields["title"] bit has the text string of what will appear in the error message (it will be substituted in the %s bit of your default error message). The value that appears in your textinput box will be your the post result NOT what you set $fields["title"] to.

Hope that helps :-) it confused me.

Code:
<?php

class Form extends Controller {
  function index()
  {
    $this->load->helper(array('form', 'url'));
    $this->load->library('validation');

    $rules["title"] = "required|max_length[2]";
    $this->validation->set_rules($rules);

    $fields["title"] = "FILED NAME TO DISPLAY IN ERROR MESSAGE GOES HERE";
    $this->validation->set_fields($fields);

    if ($this->validation->run() == FALSE) {
       $this->load->view('myform');
    }
  }
}
?>


Messages In This Thread
Validation error message is missing the field name - by El Forum - 11-04-2007, 05:26 AM
Validation error message is missing the field name - by El Forum - 11-04-2007, 06:40 AM
Validation error message is missing the field name - by El Forum - 11-04-2007, 06:50 AM
Validation error message is missing the field name - by El Forum - 11-04-2007, 07:16 AM
Validation error message is missing the field name - by El Forum - 11-04-2007, 08:18 AM
Validation error message is missing the field name - by El Forum - 11-04-2007, 08:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB