![]() |
Form_validation unset 'set_rules' - 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 unset 'set_rules' (/showthread.php?tid=61225) |
Form_validation unset 'set_rules' - El Forum - 10-21-2014 [eluser]Walle[/eluser] Hello, I have a view with two blocks. A and B. Both are used to write/change data on the database. Both blocks are in one <form> tag on the view. Now the thing I wan't to achieve is, that when I press the submit button, block B will be checked with some validation rules, and if they all succeed, block B should be comitted to the database. After block B gets validated, block A should be validated and committed to the database as well. That is not hard to achieve. But if B fails, I still want to validate A to be committed to the database, and they have to be in that order. First B, then A. You might say that A always has to be validated. I have not really an idea how to achieve that. I wrote something like this in my controller: Code: // block B I have to remove the first rule I specified in block B where I put the question marks in the else clause. But I don't have an idea how to do that. Anyone has any ideas? It would really help me out. Kind regards, Walle Form_validation unset 'set_rules' - El Forum - 10-21-2014 [eluser]Walle[/eluser] I managed to fix it, in this way: I removed the required check on the field 'description' and later in my code, I checked if the length of the submitted value was larger than 0. Not an answer to my question, but at least my form works now. Form_validation unset 'set_rules' - El Forum - 10-21-2014 [eluser]rufnex[/eluser] Why not just validate B then A in every case? Code: // block B |