![]() |
How do you prevent validation errors from showing up on first load? - 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: How do you prevent validation errors from showing up on first load? (/showthread.php?tid=51708) |
How do you prevent validation errors from showing up on first load? - El Forum - 05-14-2012 [eluser]The Revel[/eluser] I made myself a form with validation rules, that upon validate, it does some SQL work, else it shows the form. However when i load the page for the first time, it shows me validation errors because nothign has been filed out yet. The format i have is as follows (code condensed as its a lotta code): Code: //validate form input Is there a way to prevent the passing of the validation errors when nothing has been entered to begin with? How do you prevent validation errors from showing up on first load? - El Forum - 05-14-2012 [eluser]CroNiX[/eluser] Sure, only run the validation if the form has been submitted. Code: //Check for existence of submit button How do you prevent validation errors from showing up on first load? - El Forum - 05-14-2012 [eluser]The Revel[/eluser] Not sure if this would help... I am not sure where to put the validation etc. How do you prevent validation errors from showing up on first load? - El Forum - 05-14-2012 [eluser]CroNiX[/eluser] Depends on your intention. Your original code was showing something that happened if it passed validation and something else if it didn't, so that's what my code was based on except it only does it if the form was submitted. How do you prevent validation errors from showing up on first load? - El Forum - 05-14-2012 [eluser]The Revel[/eluser] [quote author="CroNiX" date="1337033727"]Depends on your intention. Your original code was showing something that happened if it passed validation and something else if it didn't, so that's what my code was based on except it only does it if the form was submitted.[/quote] I am so confused now LOL. I have looked at the Login and change password functions in Ion Auth, and they follow the same thing I have Code: function login() And it does not show the Validation Errors. Yet mine does. |