elo80ka / django-dynamic-formset

A jQuery plugin that allows you dynamically add new forms to a rendered django formset.
675 stars 309 forks source link

'Add-row' link inserted inside <table> #51

Open elo80ka opened 10 years ago

elo80ka commented 10 years ago

From alekwis...@gmail.com on November 27, 2012 16:21:02

What steps will reproduce the problem? 1. Using django-dynamic-formset with tables. What is the expected output? What do you see instead? When I use formset I expect 'Add row' link to land inside and tags. However, it is placed plain inside

tag, which is not correct according to W3C. Simple example:

The link lands here
some inputs here

where formset is generated by: $('#form tbody tr').formset();

When I try to wrap 'add-row' in tds and trs it works fine, but new rows added by clicking are wrapped in these tags too.

Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=51

elo80ka commented 10 years ago

From stan.madueke on November 27, 2012 09:45:18

Status: Accepted
Owner: stan.madueke

elo80ka commented 10 years ago

From rhbl...@gmail.com on December 14, 2012 04:33:39

Please see http://bugs.jquery.com/ticket/9228 - As of jQuery 1.6 it seems like the $$.attr('tagName') should be replaced with $$.prop('tagName').

Please see attached patch.

Attachment: issue51.patch

elo80ka commented 10 years ago

From alekwis...@gmail.com on December 19, 2012 04:18:11

Ok, now it's much better. Hover, I altered your: $$.parent().append(buttonRow) to $$.after(buttonRow). If you got more than one form, the buttonRow-s were added at the end of table, so one can get confused seeing three buttons saying "Add another". Now the buttonRow is in the right place. numCols is ok I put my hidden form elements inside . Lots of work, but now the form is HTML-correct, and it shows ok in IE. Thanks for help.