[solved]$this->input->post() not working? |
[eluser]brucebat[/eluser]
Hi all, My post function I seem to remember was working yesterday but for some reason it does not appear to work now after doing work on my View (CSS etc). pic—> http://i.imgur.com/lpOqB.jpg This is the code here which finds the last row entered by user which is found in my controller. The problem is that it is giving back an error messages saying that all the rows are required when it should only be up to whatever the user enters. e.g. the user completes 4/20 rows and forgets to enter a name in the “event” field in row number 4 then it would say “Name field in row 4 is required”. However now it is saying they are all required? :S Code: //counter starts at zero which matches the field names that start at zero Code: <input name="time0" value="00:00:00" maxlength="8" size="6"> Spelling is fine and it matches up at other side. -I have tried checking to see if another input field has been unchanged and it works. -When I try echoing a assigning a test variable from the post and then echoing it as I have shown above it does not echo anything. This is really strange. I have a suspicion that its my View heres the pastebin: http://pastebin.com/iNiWnqib I have made a workaround for it at the moment which is just checking the “event” field instead of time but why is that working and not the other.
[eluser]brucebat[/eluser]
Fixed it: Apparently if you have form_label() outside of form_open() It can break your form! This was what was wrong: Code: //Title
[eluser]Aken[/eluser]
The form_label() function only generates an HTML <label> tag, which can be placed anywhere on a page, even without a <form> tag all together. <label> tags are also no part of the values that are submitted through a form, so there's zero ways that it would break your $this->input->post() on its own. Based on your view, I'd say it has something to do with how you're processing the form through Javascript. JS is expecting to find those labels inside the <form> element, when you are placing them outside. I didn't go through your code enough to find out for sure, but I'd hate for you to unintentionally mislead anyone with a "fix" that is actually unrelated.
[eluser]brucebat[/eluser]
My javascript only generates textfields. When I compared my version of the forms using notepad++ the only differences where that my old form which worked had no form_labels() in it and my new one did. So I removed them and then repositioned them and it worked. |
Welcome Guest, Not a member yet? Register Sign In |