I’m in the middle of creating a section in an add / edit page which is responsible for managing video payloads to users (i.e. - I’m using “Field Collection” to encapsulate a few different form fields used to manage video uploads and or URLs, etc.).
Here’s the issue: I’d like to retain the values in the fields after a user clicks on the “Add another item” button. Is this possible? Currently, whenever someone clicks on this, the values within the fields simply disappear / get reset, which sucks.
From what I understand so far from everything I’ve read up to this point, this is all part of Drupal’s “AHAH” architecture but despite having direction in all this, I’ve still been unable to implement anything that allows me to override something from within template.php to output a simple dpm() of whatever might be in the form fields at the time someone clicks on the button to add another item. I’d hate to think that this is because of the Field Collection functionality, but who knows?
Long story short, I just want to retain the values after someone adds another item. Period. I don’t want them to disappear like they’re doing now.
Any insight into this would be really appreciated.
Are you talking about on a node form with a field that accepts multiple values? If so you are saying when you click “Add Item” for that field that previous value entered vanishes and you are only left with a single item? If that is the case that sounds like a bug within whatever module that field is associated with. If I’m understanding correctly. The default behavior of a field that allows multiple values is to keep the previous value when adding a new item via asyncronous request.
I just took a look at the field_collection module. Another module that probably has yet been abandoned by high profile Drupal devs to work on the next latest and greatest thing. They could at the very least change the status… Probably won’t get any support for that if it is a bug since I believe Drupal 8 has that functionality built in.
Hey oddz, what would you use for field collections in D8? I’m still using D8 Alpha 5 (Alpha 6 is the current). I don’t see a way to do a collection of fields. I suppose the built in Entity Reference Field could be used. Have you seen anything?
Maybe… Definitely something to keep an eye out for though… It seems like an obvious feature to have once you’ve tried it with the field collections module.