Form not including all fields... |
[eluser]mihaibaboi[/eluser]
Ok, so I got home and tried to replicate what you have. In order to make it easier for me, I used jQuery to add the dynamic field. But other than that, I hope I have the same setup as you do. So, my "dinamic_form.php" view looks like this: Code: <!DOCTYPE html> As you can see, I have a form that submits to the "forms" controller (witch is the same that I'm calling for display) only I use the submit() method instead of index(). Also there are two placeholders before the submit button that will hold the dynamic fields. When I click each link, I use JavaScript to replace the link with a field. The "forms.php" controller is dead simple. It looks like this: Code: class Forms extends CI_Controller { Code: Array As you can see, I have access to all the fields in the form, so I don't think it's a CodeIgniter issue. The code I provided is complete, so feel free to use it and compare to what you have. On the other hand, there maybe something else I'm missing. Is there something your doing that I didn't catch? Or is this what you wanted to achieve?
[eluser]ximbo_fett[/eluser]
The only difference is that I wasn't using jQuery. I was just using DOM to try this. Let me give this a shot...
[eluser]ximbo_fett[/eluser]
Thanks mihaibaboi, Here's a stupid question for you about jQuery. How are you calling jQuery into your script? I haven't had much exposure to jQuery and I'm getting errors from your code. Do you have jQuery set in your autoload.php? Thanks for your help!
[eluser]louisl[/eluser]
You can just call it in the header of your page from a cdn or have it local. <foo src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></foo> replace foo with script and you're good to go. http://docs.jquery.com/Downloading_jQuery @ mihaibaboi not sure why you're doing all those escape chars, I find it best to use single quotes with strings for html type things ;-) Code: $('#genderRow').html('<p><label for="gender">Gender</label><input type="text" name="gender" id="gender" /></p>');
[eluser]mihaibaboi[/eluser]
[quote author="ximbo_fett" date="1301965375"]How are you calling jQuery into your script?[/quote] jQuery is inclded using the script tag at the beginning of the view (just like louisl said). As for the instance of jQuery, it's made automatically when you call jQuery specific code (like the $(element) selector). You can have la look at the jQuery docs if you want to get started (they'r pretty comprehensive). @louisl I don't really like single quotes (I know, it's crazy). And your'e right, I should have used them here, at least to make the code easier to read
[eluser]ximbo_fett[/eluser]
Just wanted to let you all know that I figured out what was going on. Apparently CI has issues where the form open tag is placed. After getting dynamic content to submit and display correctly outside of CI, I got it to work on an unbranded page inside CI. I then started disabling each page element until it worked... The culprit??? I had the form open tag in inadvertently situated outside of the table in between rows. While this may not be proper, it works outside of CI. Inside CI however... disaster... Just wanted to thank everyone for their help with this! I have my form doing what it should be doing... :-)
[eluser]mihaibaboi[/eluser]
It makes sense not to work in CI, but I'm kind of puzzled why it would work anywhere else. An unproperly nested form tag will be thrown somewhere in the document flow (id the nesting involves tables). What I'm trying to say is that it shouldn't have worked anyway. Are you sure that the non CI code was replicating exactly what you had in CI?
[eluser]ximbo_fett[/eluser]
It was replicated exactly outside as was inside CI. The form should, in theory, never have worked to begin with because of exactly what you said. The tag placement was an oversight on my part. Once I saw it, I knew it was exactly what was causing the problem...
[eluser]mihaibaboi[/eluser]
Strange, but no matter. The important thing is that it works now, and your code is up and running I think I'll look into this issue one afternoon when I have some time to kill.
[eluser]mihaibaboi[/eluser]
Just out of curiosity. Could you post the HTML that you were testing on? You can remove the JavaScript and stuff. I'm just interested to see the way the form was nested in the table, so that I can play around with it. Thanks. |
Welcome Guest, Not a member yet? Register Sign In |