Form Validation (Twice) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Form Validation (Twice) (/showthread.php?tid=15510) |
Form Validation (Twice) - El Forum - 02-06-2009 [eluser]PV-Patrick[/eluser] Is it possible to run a validation process twice, one inside the other? Example: Code: if($this->form_validation->run('val1') == FALSE): For some reason I can't seem to get it to work... any help would be appreciated, thanks! Form Validation (Twice) - El Forum - 02-06-2009 [eluser]xzela[/eluser] do you have a reason on why you would want to run it twice? Form Validation (Twice) - El Forum - 02-06-2009 [eluser]PV-Patrick[/eluser] Ya, I'm trying to get past some credit card authorization problems that are apart of the form. Form Validation (Twice) - El Forum - 02-06-2009 [eluser]Michael Wales[/eluser] I still don't understand why you would need to validate twice... maybe if you provide a more detailed example we can help you out. Form Validation (Twice) - El Forum - 02-06-2009 [eluser]macigniter[/eluser] I am running the validation twice in one of my controllers because I want to validate one rule before all others. This way I don't get all of the error message of the second validation if the first one didn't even pass. I am using this approach: Code: // set first validation rule Is that something you anticipated? Form Validation (Twice) - El Forum - 02-06-2009 [eluser]PV-Patrick[/eluser] Hi Michael, I am trying a different route for dealing with credit card validation/processing. Before, I would authorize the card at the same time as validating the form and stored the authorization status in a session variable. So if the form didn't validate, it wouldn't try and authorize their card on each failed form validation attempt. Thus, I was using an AUTH_ONLY, then PREVIOUS_SALE - 2 function calls for the credit card. I was trying to bypass this method and use 2 validations and not set session variables so I can then use an AUTH_CONVERT for the CC. I validate the form first as there are two payment methods, 1 for credit card and 1 for paypal, which has two different validation arrays. I hope that helps, thanks guys! EDIT: @ macigniter I guess my way about it is a more nested approach.... Not sure if it matters? Might need to pull it out of each other and basically have it similar to your case. Code: if($this->form_validation->run('val1') == FALSE): Form Validation (Twice) - El Forum - 02-06-2009 [eluser]PV-Patrick[/eluser] As an update, I tried doing it without the nesting and it doesn't work either... Form Validation (Twice) - El Forum - 02-07-2009 [eluser]PV-Patrick[/eluser] Any updates to this? Can't get it working... Form Validation (Twice) - El Forum - 02-12-2009 [eluser]PV-Patrick[/eluser] Does anyone have suggestions on how to work cc processing with CI validation of forms? I really don't want to use a session variable to store an auth status... Form Validation (Twice) - El Forum - 02-13-2009 [eluser]Unknown[/eluser] Hi, I had the same problem today, and I made a very quick fix (Surely there is another more fashionable method). I extended CI_Form_validation class, and I set my version of run method: --------------------------------------------------------------------------------------- Code: function run($group = '', $use_only_group = false) |