#11632: show_hidden_initial=True produces invalid HTML --------------------------------------------+------------------------------- Reporter: ge...@datacollect.com | Owner: Status: new | Milestone: 1.2 Component: Forms | Version: 1.1 Resolution: | Keywords: show_hidden_initial Stage: Accepted | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------------+------------------------------- Comment (by anonymous):
I've just encountered this issue myself. I'm conflicted on what the solution should be. Since the <name> field gets 'initial-' prefixed to it, it seems like it would be consistent ti prefix the 'initial-' on the id. However, in practice that has issues. I have jquery code that finds dom objects by searching for them like this: row.find('[id$=foo]') ie, this finds a dom element whose name ends in 'foo'. Once I started using show_hidden_initial, my jquery code broke since it now finds two items whose name ends in 'foo'. I suspect other folks might do similar types of selectors. Adding 'initial-' to the front of the hidden initial input wouldn't help in this situation. Of course I could do a more compex jquery selector and ignore stuff that starts with initial-. Getting rid of the id altogether on the hidden initial element fixes my issue, but leaves one in the unpleasant situation of never being able to find that hidden initial element in your dom - or at least not with a lot of trouble. So I don't really think it's a great solution. It seems like the most complete solution would allow the user to specify a "hidden initial auto id" when they instantiate a form, similar to the way they can specify the auto_id argument when they instantiate a form. -- Ticket URL: <http://code.djangoproject.com/ticket/11632#comment:7> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.