• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved]Custom Validation?

#11
[eluser]Mirge[/eluser]
[quote author="brucebat" date="1312331674"]Correct

My function is within the Controller class.


The example uses the $str as an argument,

Code:
function username_check($str)
    {

}
[/quote]

Post the entire controller please. And yes, $str is fine. You could call it $someStupidLongVariableNameThatIProbablyShouldNotUse if you wanted.

#12
[eluser]brucebat[/eluser]
Too big for the forum so here is Pastebin Link

http://pastebin.com/axRVAB8u

Thanks

#13
[eluser]Mirge[/eluser]
Put something like: echo 'got here - inside for loop'; immediately after the opening brace of the for loop.. make sure it's even getting in there.

EDIT:

I don't see a constructor. And is form_validation library auto-loaded?

#14
[eluser]brucebat[/eluser]
Code:
echo "hello".$i;

Okay tried that and it is working:
So if the user completes three rows I get:

Quote:hello0
hello1
hello2

#15
[eluser]Mirge[/eluser]
See my edit, sorry.

#16
[eluser]brucebat[/eluser]
form_validaiton is autoloaded.


Would a constructor be necessary? From my understanding of constructors in C++ they are used to create class attributes and set values? But in my class there are no attributes being shared in the class?

Thanks

#17
[eluser]Mirge[/eluser]
Not sure if they're required or not... I do know you have to call parent::__construct() if you have a constructor. Not sure if the base class constructor gets called automatically or not. I'd add a constructor & see if it does anything. If not, was only a few seconds lost.

#18
[eluser]brucebat[/eluser]
Ok I placed a constructor in the class, should I put anything inside it?

So far its not done anything Smile

Hmmm

#19
[eluser]Mirge[/eluser]
Code:
public function __construct()
{
     parent::__construct();
     $this->load->library('form_validation'); // just to test.
}

Very strange issue, if that doesn't work. I'll have to look at code again.

#20
[eluser]brucebat[/eluser]
DOH!!!

I am so silly,


I was calling the error reporting before the form_validation was being run.

Okay so the form_validation works and the function is getting called as the "hello world" echo i put it in it is being displayed however it is not giving an error message.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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