Welcome Guest, Not a member yet? Register   Sign In
Running validation multiple times on single request
#1

[eluser]feel[/eluser]
On my page I have a regular form with some validation rules defined in form_validation.php file. There are also some custom validation callbacks defined. It all works fine.

The same input can be provided in an excel file where a single row contains the same data as the form can capture. I would like to use the same rules to validate multiple rows, one by one.

After I read a row from the spreadsheet I populate the $_POST array with the same keys as defined in my webform. Then I call the appropriate validation rule:
Code:
if($this->form_validation->run('item/add') == FALSE) ...

The problem is that this works ok only for the first row. For the second row some validation rules are not triggered (e.g. basic 'required' rule). Also, if the validation fails for a single row the error is remembered and all future calls to $this->form_validation->run('item/add') result with the same error message, even if current row is valid.

I tried resetting the validation by calling the following code (with no luck):
Code:
$this->form_validation = new CI_Form_validation();

Any ideas?


Messages In This Thread
Running validation multiple times on single request - by El Forum - 07-04-2011, 06:06 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 06:37 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 06:48 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 08:18 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 08:36 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 08:48 AM
Running validation multiple times on single request - by El Forum - 07-04-2011, 10:02 AM
Running validation multiple times on single request - by El Forum - 07-14-2011, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB