I have a field collection "Entry Information", where the user should be able to add multiple entries before proceeding to the contact information page. The "Add Additional Entry" button works, as does the whole form. However ... the project manager now wishes to hide the previous entry when the "Add Additional Entry" button is clicked. I, and a more knowledgeable Drupal dev, explained that this was a bad idea because 1) it was non-standard Drupal behavior and 2) the user would no longer have the ability to edit or delete the previous entry. Disregarding the advice, I have been ordered to make it so. The problem is that when the new instance of the field collection is added to the form, it is as an unidentified TR table row (i.e, it has classes, but not an ID which specifically identifies the TR).
The first, default, TR has classes "tr .draggable odd drag-previous", the second classes "tr .draggable even", the third classes "tr .draggable odd", the fourth classes "tr .draggable even", and so on.
So, there is no way I can see to write some javascript which would hide the previous rows when a new row is ajax'd into view. (The same PM told me ajax has nothing to do with it, but that is indeed how objects are added to the DOM.)
So, I guess my question is "How do I add an ID to each new field collection row as it is ajax'd into existence?"
Hopefully I can figure out the javascript once that hurdle is cleared ...
Comments
This is from the TD cell
This is from the TD cell contained by the TR which was added. Note the TR has no ID.
tr .draggable even
I grepped the project's entire codebase -- included all installed modules, custom or otherwise -- for instances of "
These are the only instances
These are the only instances of "<tr" I could find where the TR has classes, and none of them look likely to produce the additional entry: