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

[eluser]gtech[/eluser]
Hello its very difficult to see without your code whats going on.. I tried following the example from the validation documentation and the %s worked fine for me, maybee you could cut and copy the code examples, especially the controller in "Callbacks: Your own Validation Functions". Then you can satisfy yourself it works.


the following code also worked for me (slightly modified from documentation)
Code:
function index()
    {
        $this->load->helper(array('form', 'url'));    
        $this->load->library('validation');
            
                $this->validation->set_message('required', '%s custom message here');

        $rules['password']    = "required";
        $rules['passconf']    = "required";
        
        $this->validation->set_rules($rules);
            
        if ($this->validation->run() == FALSE)
        {
            $this->load->view('myform');
        }
        else
        {
            $this->load->view('formsuccess');
        }
    }

views/myform.php
Code:
<html>
  <head>
    <title>My Form</title>
  </head>
  <body>
    <?=$this->validation->error_string; ?>
    <?=form_open('form'); ?>
      <h5>Password</h5>
      &lt;input type="text" name="password" value="" size="50" /&gt;
      <h5>Password Confirm</h5>
      &lt;input type="text" name="passconf" value="" size="50" /&gt;
      <div>&lt;input type="submit" value="Submit" /&gt;</div>
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;

resulting in
Code:
password custom message here
passconf custom message here


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