simple error question |
[eluser]Unknown[/eluser]
Hello Everyone!! Im trying to figure out an error Im getting with validation class. I have 2 views register and register process im doing some validation in register process that redirects ur back to register. for some reason, when processing errors, since errors are instaniated at regprocess, when you come to the main register, you get this error Quote:Message: Undefined property: CI_Validation::$first_name_error is there a way I can set this ? Any help would help Thanks
[eluser]eggshape[/eluser]
In your view do you have code that looks like this: Code: echo $this->validation->first_name_error; if you do and you have no error for $first_name you will get that message. change your view to: Code: if (isset($this->validation->first_name_error)) echo $this->validation->first_name_error;
[eluser]RyanH[/eluser]
I'm having a similar issue. I have a registration page that has validation and it's something like this: Code: <input type="text" name="name" value="<?=$this->validation->name;?>" /> <?=$this->validation->name_error;?> PHP Error Wrote:A PHP Error was encounteredAs with the registration page that works just fine, the rules are set as are the fields. Why would this work on one page and not the other?
[eluser]Seppo[/eluser]
Are you using PHP 4, and do you have Validation in autoload libraries?
[eluser]RyanH[/eluser]
[quote author="Seppo" date="1201165838"]Are you using PHP 4, and do you have Validation in autoload libraries?[/quote]I'm using PHP 5 and the validation library is not auto loaded. However why would this work just fine with no problems on my registration page but not on my contact page when everything is setup the same?
[eluser]Seppo[/eluser]
Just checking a possible error... Can you copy the controller code?
[eluser]RyanH[/eluser]
[quote author="Seppo" date="1201166632"]Just checking a possible error... Can you copy the controller code?[/quote]Sure, here it is: Code: <?php Code: <html> Thanks for your help!
[eluser]Seppo[/eluser]
You are loading the view before setting the validation fields/rules :S And then calling it again...
[eluser]RyanH[/eluser]
I don't understand. Near the top I'm loading the view file. I'm only loading it again when the form is submitted and if the validation fails. Is this incorrect?
[eluser]Seppo[/eluser]
The first time should be after setting the fields and the rules... That´s why it can´t find the fields errors: they aren´t setted. The second time is also calling the view, cause it is failing the validation... A simplier way to do it Code: function index() |
Welcome Guest, Not a member yet? Register Sign In |