Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a nodereference field that seems to stop working after I click 'Add another item'...
The fields that are initially displayed work fine. But if I want to add another field, after clicking 'Add another item' it doesn't work (the little circle doesn't rotate and no results are displayed when entering text). Also, the original fields no longer work either - if I delete their values and try searching again, nothing happens...
Any ideas?
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedSearching for "javascript add another item" reports a few issues that may be related to your problem.
If none of those issues match, then we need a recipe to reproduce the problem. Do you see errors in Drupal logs? Apache logs? Javascript? Could it be caused by another module that breaks the autocomplete?
Comment #2
BWPanda CreditAttribution: BWPanda commentedI've discovered that the problem only occurs for fields within a flexifield, specifically autocomplete node reference fields in a flexifield.
Also, the problem seems to have changed: Javascript keeps working after the 'Add another item' button is clicked, but any previously entered values are replaced with a single space...
Moving to the FlexiField issue queue.
Comment #3
BWPanda CreditAttribution: BWPanda commentedChanging title...
Comment #4
BWPanda CreditAttribution: BWPanda commentedOk, it seems this bug is limited to autocomplete fields - multivalued textfields work fine...
Comment #5
BWPanda CreditAttribution: BWPanda commentedLooking at the code, it seems the problem lies somewhere just before
$aBuiltForm = form_builder($_POST['form_id'], $aFormCopy, $aFormState);
on line 275 of flexifield-widget.inc...The #value of the fields in $aBuiltForm are not the same as what was entered before the form was re-built.
Not sure where exactly the problem lies or how to fix it...
Comment #6
effulgentsia CreditAttribution: effulgentsia commentedI'm not replicating the bug in my development environment. I sent BWPanda an email asking for more details, and will set the issue back to active when I can replicate the bug.
Comment #7
BWPanda CreditAttribution: BWPanda commentedThanks for the email effulgentsia! I may as well reply here, for the benefit of everyone else...
My dev site (where the problem occurs):
Drupal 6.14
AHAH Response 6.x-1.1
CCK 6.x-2.6
Flexifield 6.x-1.0-alpha5 & 6.x-1.x-dev (tried both)
Exports of my content types attached.
'Multivalued Fields' is the FlexiField content type, while 'Story' has the FlexiField field in it.
Creating a Multivalued Fields node works fine - the autocomplete fields don't muck up at all. It's only when creating a Story node that the problem occurs, and then only for the autocomplete fields.
The Node Reference field in Story that isn't part of the FlexiField works fine if that's the first thing you add, but if you start entering values in the FlexiField then try to use the other Node Reference field, it starts mucking up too...
Hope that helps!
Comment #8
BWPanda CreditAttribution: BWPanda commentedOops, forgot to attach exports, sorry :)
Comment #9
effulgentsia CreditAttribution: effulgentsia commentedThanks. The attachments helped. This bug uncovered a bug in the ahah_response module. Please try again with version 1.2 of that module.
Comment #10
BWPanda CreditAttribution: BWPanda commentedDoesn't seem to have worked... Tried again on the story node, but same problem.
Also tried setting up the multivalued fields in the page content type, but again, same problem.
Comment #11
BWPanda CreditAttribution: BWPanda commentedHow's it going, any progress?
Comment #12
effulgentsia CreditAttribution: effulgentsia commentedPlease try again with latest dev of flexifield (get from CVS or wait until dev snapshot has later timestamp than this comment).
Comment #13
BWPanda CreditAttribution: BWPanda commentedThat seems to have done the trick - autocomplete fields in FlexiField working now!
Thanks a bunch effulgentsia!
Comment #15
amclin CreditAttribution: amclin commentedI seem to be seeing the same issue. If I have any Text Fields with "autocomplete for existing field data" widget as part of a FlexiField, then the add another button doesn't work, and when saving a content item, the FlexiField data is not stored. I'm using the Nov 28 timestamp.