Welcome Guest, Not a member yet? Register   Sign In
Loading the form and validating in the same function?
#11

[eluser]parham90[/eluser]
Duh! And I thought through some magic trick I'd never come to understand, this code example I saw on the net works like a charm! Smile

Thanks a lot, and sorry for causing you all frustration.
#12

[eluser]Ivan A. Zenteno[/eluser]
But why your controller is like that? I mean the controllers is like then:

Code:
function foo()
{
    $rules = array('THE RULES HER');
    $this->form_validation->set_rules($rules);
    if($this->form_valitaion->run())
    {
       //foo true
    }
    else
    {
       //var false
    }
}
#13

[eluser]parham90[/eluser]
Yes, I read that piece of code I wrote (well, something like that) somewhere on the Internet. I assumed the rules have to be set only when the page is loaded as a form, and therefore, the strange form you saw. It is fixed now, though.
#14

[eluser]skunkbad[/eluser]
If you'd like to see a working example of form validation and posting to the same method, you might check out the add_category method on this page:

http://bitbucket.org/skunkbad/community-...entory.php
#15

[eluser]parham90[/eluser]
Thanks! A great tip. Smile




Theme © iAndrew 2016 - Forum software by © MyBB