Welcome Guest, Not a member yet? Register   Sign In
Continuous Loop in form validation
#5

[eluser]cideveloper[/eluser]
I always have a hard time explaining form validation but I will attempt to help and kinda figure out what is going on here.

Code:
$this->form_validation->run() == FALSE

runs initially when the form has not been submitted to be validated or when validation fails.
So when you say

Code:
$artwork= $this->form_validation->set_rules('kunstwerk', 'Kunstwerk', 'trim|required|min_length[5]');
               if($this->form_validation->run() == FALSE)
                {
                  $this->input();
                }

and $artwork is <5 then you will just rerun the input function. Since you are not redirecting or anything else like that

Code:
$kunstwerk == $this->input->post('kunstwerk')

will be true again, and validation will fail again and you will go back to input function. voila infinite loop.

what I dont understand is why you are setting the variables

Code:
$artwork= $this->form_validation->set_rules('kunstwerk', 'Kunstwerk', 'trim|required|min_length[5]');

$kunstwerk == $this->input->post('kunstwerk')

why wouldnt you just do this

Code:
$this->form_validation->set_rules('kunstwerk', 'Kunstwerk', 'trim|required|min_length[5]');

$this->input->post('kunstwerk')

also in your ajax call

Code:
url: [removed]

I assume you are sending a 3rd segment in the uri?


Messages In This Thread
Continuous Loop in form validation - by El Forum - 01-06-2011, 05:17 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 06:23 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 07:00 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 07:17 PM
Continuous Loop in form validation - by El Forum - 01-06-2011, 11:26 PM
Continuous Loop in form validation - by El Forum - 01-07-2011, 04:12 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 05:01 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 08:50 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 09:02 AM
Continuous Loop in form validation - by El Forum - 01-07-2011, 11:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB