![]() |
form validation - validation error before form submit - 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 - validation error before form submit (/showthread.php?tid=3777) |
form validation - validation error before form submit - El Forum - 10-21-2007 [eluser]jahboite[/eluser] I'm using the form helper and form validation, but I get differences on loading the page between my webserver at home (php5) and my hosted webserver php4. Here's a snippet from my controller: Code: function index() Code: <?php On my webserver at home, I get the behaviour I expect. On the hosted box, I get a "must have a value" validation error for both of the fields when I load View A, before I've even submitted the form. Is this likely to be something to do with the version of php, my code, or the fact that the page is being rendered by facebook. form validation - validation error before form submit - El Forum - 10-21-2007 [eluser]jahboite[/eluser] Okay, I've solved this. I'm not exactly sure why, but the problem is a facebook thing. Whenever one does a POST, fb adds certain things to the POST array. I was already aware of this, because before using a Code: $this->db->insert('table_name',$_POST); Code: function unset_fbpost($uset) Anyway, when using ONE view and posting to itself as in my previous posting, the POST array seems to trigger the validation on it's initial load because of the facebook stuff. A combination of CI and facebook = weirdness! So I solved it, by having an initial view which shows the form, but without the validation and which posts to another function. This other function can then handle the validation as per my previous post. Seems to work. Hope this saves someone several hours! |