JasonLewis Posted August 28, 2011 Share Posted August 28, 2011 This relates to Ajax as well but more-so JavaScript. Let me use an example. I have a tagging system that's using Ajax to auto-suggest tags. The user can then select a tag from the suggested tags or add the tag they want. If they select a tag, is the best way to go about it adding that tag ID to a hidden field as a comma separated list. Or... keep the selected tags in an array and attach an event to the submit handler of the form, then once submitted insert X amount of hidden inputs (where X is the number of tags) so that I'll have an array of selected tags when they submit. In the past when I've done things like this I've just updated a hidden input each time a tag is added/edited, however I'm just wondering if the second approach is possible and if it's better. The only possibility I can think of is that it won't work due to the form already being submitted and thus the inputs aren't actually added to the post data. I am yet to test this. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/245860-best-way-to-handle-dynamic-form-data/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.