CodeIgniter Forums

Full Version: Using a custom form_validation function to check two fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi there! I'm new to this forum, and have only two hours of experience with CodeIgniter... I'm working on it though, and working my way through the User guide (actually creating a small application).

I've come to the topic of form_validation now, and there's one thing I want to know:
How do I pass two field values (for instance 'username' and 'password') to a custom function?
Say, I would like to see if the two exist in one table row. I've read how to make a custom function, but can't find a (or the) way to use variables of two fields.

Anyone?

El Forum

[eluser]Dam1an[/eluser]
You're new but have been registered for a year?... Oh well

AFAIK, it's a current limitation of the validation class that it can only handle a single field per rule, which make sense if you think about it. maybe someone's made an extensions to do what you want?

Am I correct in assuming you want to do a callback for a login function? Why not just do the check afterwards once the data has been prepped?

El Forum

[eluser]Unknown[/eluser]
[quote author="Dam1an" date="1245370977"]You're new but have been registered for a year?... Oh well[/quote]

Quick response! I'm new to the CodeIgniter forum. Have been registered for a year to the ExpressionEngine forum though. Both EllisLab, so maybe I should've said 'new to the CodeIgniter forum'...

Quote:Am I correct in assuming you want to do a callback for a login function? Why not just do the check afterwards once the data has been prepped?

Correct you are... That's an option. Maybe even a better one Wink I will try to work this out.

El Forum

[eluser]Dam1an[/eluser]
oh, I didn't know it used the same set of credentials (or more specifically the same start date)
And that would also explain why their are some users here with only 1 or 2 posts, but a huge post count

El Forum

[eluser]Thorpe Obazee[/eluser]
[quote author="Dam1an" date="1245371708"]oh, I didn't know it used the same set of credentials (or more specifically the same start date)
And that would also explain why their are some users here with only 1 or 2 posts, but a huge post count[/quote]

Yeah, I figured that out when I tried posting in the EE forums.