![]() |
Form Validation ARGH!!!! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Form Validation ARGH!!!! (/showthread.php?tid=12615) |
Form Validation ARGH!!!! - El Forum - 10-25-2008 [eluser]Adam Griffiths[/eluser] Firstly, let me show you my controller code. Code: <?php And my form code... Code: <div id="top"> Ok so the problem is that the form isn't shown on the page, it's blank where the form is supposed to be. I believe I followed the user guide correctly, and cannot see any errors in the code, any ideas? Form Validation ARGH!!!! - El Forum - 10-25-2008 [eluser]dbashyal[/eluser] did you turn on error reporting? by the way isn't it suppose to be $action inplace of $data['action'] in form view and so on... Form Validation ARGH!!!! - El Forum - 10-25-2008 [eluser]Randy Casburn[/eluser] Hi Adam, If what you have your submit button show up but nothing else, it appears to me that your array $fresh is empty. So the foreach() loop never executes and your form elements are never built. That would appear to mean only the form header and submit button are put up there. Just a guess really. Hope that's helpful. Randy Form Validation ARGH!!!! - El Forum - 10-26-2008 [eluser]Adam Griffiths[/eluser] [quote author="dbashyal" date="1225015422"]did you turn on error reporting? by the way isn't it suppose to be $action inplace of $data['action'] in form view and so on...[/quote] It is supposed to be $data['action'] because I pass it through my crud library, it's a little complex to explain without the code but anyways thanks for the input. [quote author="Randy Casburn"]Hi Adam, If what you have your submit button show up but nothing else, it appears to me that your array $fresh is empty. So the foreach() loop never executes and your form elements are never built. That would appear to mean only the form header and submit button are put up there. Just a guess really. Hope that’s helpful. Randy[/quote] I just dumped that variable and nothing was outputting from the view, but inside the library it was fine. So I went through my view and took out the parts that fill in the form again if something goes wrong and the variables that show the error and now the form shows. Step 1 complete. But now when I submit the form nothing happens, it comes back to the form, no errors are shown at the top or anything. Here's the new view code. Code: <div id="top"> Thanks for the input guys it really is appreciated. Form Validation ARGH!!!! - El Forum - 10-26-2008 [eluser]Randy Casburn[/eluser] [quote author="Adam Griffiths" date="1225041820"] But now when I submit the form nothing happens, it comes back to the form, no errors are shown at the top or anything. Here's the new view code.[/quote] I don't see anything glaring out at me that is wrong with your work now. So it sounds like one of two things are happening then. 1) The form is posting but the $_POST array is not handled or recognized properly for some reason. -- To check this you can print_r($_POST) or echo $this->input->post('whatever') -- Do this just above your call to validation->run() 2) The form isn't validating, and the "echo validation_errors();" statement is not displaying the errors for some strange reason. I would investigate those. And you're very welcome for the help. Randy Form Validation ARGH!!!! - El Forum - 10-26-2008 [eluser]Adam Griffiths[/eluser] Ok print_r($_POST_; return this. Quote:Array Which is the form without anything in it. So it must be that the errors aren't showing, I will investigate. Hmmm, I have looked at the code, I've changed the fields to be just HTML instead of using the form helper, added the set_value() option aswell as the errors separately next to each field element and on the top of the form and it still won't show any errors. Code: <div id="top"> This is such a weird error. Form Validation ARGH!!!! - El Forum - 10-26-2008 [eluser]Randy Casburn[/eluser] Yea, At this point you may want to search for 1.7.0 Validation Class problems. There have been a lot of posts about the new class. This is likely beyond my reach as I don't use the validation class too much and haven't looked at the new version at all. I think this is bigger than your code. From what I see you've done everything by the book. I hope I've helped you some up to this point at any rate. Randy Form Validation ARGH!!!! - El Forum - 10-26-2008 [eluser]Adam Griffiths[/eluser] Ok no problems. Yeah thanks Randy you've been a big help. |