I have created a few months ago standard fields (text) with unlimited values. Everything was fine on the production website (distant server).

Today, I can not add another item, the Javascript icon is turning and then nothing happens. No new input box appears below.

Surprisingly, the same fields still work on the local test version (same Drupal version, same updated modules).

On the production website, if I create a new field totally similar (text, unlimited values), everything works fine and I can add multiple values, no problem with the javascript. It seems like previous fields have been shut down.

I have tried many different things (jQuery Update module configuration, new theme, deactivation/reactivation of modules, cache flushing from PHPMyadmin...). I am more a site builder than a developer so I have never modified the Drupal core code. In Firebug console, no javascript errors appear.

Does anyone know if I could fix my "broken fields" so I can still use them instead of creating new ones and cloning all the values already entered? Is it a problem with Javascript? PHP version (5.6 for local, 5.4 for distant)? CSS (new input hidden)? Module interference (jQuery update)?

Thanks in advance for any tip.

I have attached two simple screenshots to illustrate the issue location.
I have made a very short screencast to show the problem.

Comments

Toki created an issue. See original summary.

toki’s picture

Issue summary: View changes
cilefen’s picture

Issue tags: -field, -Unlimited items, -add

What is logged by Drupal and the PHP error log?

toki’s picture

The recent log messages in Drupal show no JavaScript or ajax errors. Concerning PHP error log, I have no direct access to this information, if I am right. So I need to contact my server administrator to get the info.

EDIt : no error logs in PHP log, no HTTP errors, no 404...
POST requests are created but no effect on display, no new input box.

toki’s picture

I have tried to change the PHP version from 5.4 to 5.6 and it still does not work.

I have screened the HTML code created after clicking on Add another item through Firebug console (POST JSON tab, data line).

And it appears that something is missing for the broken field (on production site) compared to the new working fresh field (on production site too) : there is no div with id="field-fieldname-add-more-wrapper".

Searching the Drupal forum, I found this discussion.

Could it be related to my issue?

Here are the codes :

<!-- POST JSON data HTML code for a Drupal field with unlimited values (good one) -->
<div id="field-champ-multi-test-add-more-wrapper--2">
<div class="form-item">
<div class="overflow-fix">
<table id="field-champ-multi-test-values--2" class="field-multiple-table sticky-enabled">
<thead>
<tr>
<th colspan="2" class="field-label">
<label class="fel-field-label">Champ multi test </label>
</th>
<th>Order</th>
</tr>
</thead>
<tbody>
<tr class="draggable odd">
<td class="field-multiple-drag"></td>
<td>
<div class="form-item form-type-textfield form-item-field-champ-multi-test-und-0-value">
<input class="text-full form-text" type="text" id="edit-field-champ-multi-test-und-0-value--2" name="field_champ_multi_test[und][0][value]" value="test1" size="60" maxlength="255" />
</div>
</td>
<td class="delta-order">
<div class="form-item form-type-select form-item-field-champ-multi-test-und-0--weight">
<label class="element-invisible" for="edit-field-champ-multi-test-und-0-weight--2">Weight for row 1 </label>
<select class="field_champ_multi_test-delta-order form-select" id="edit-field-champ-multi-test-und-0-weight--2" name="field_champ_multi_test[und][0][_weight]">
<option value="-1">-1</option>
<option value="0" selected="selected">0</option>
<option value="1">1</option>
</select>
</div>
</td>
</tr>
<tr class="draggable even">
<td class="field-multiple-drag"></td>
<td>
<div class="ajax-new-content">
<div class="form-item form-type-textfield form-item-field-champ-multi-test-und-1-value">
<input class="text-full form-text" type="text" id="edit-field-champ-multi-test-und-1-value" name="field_champ_multi_test[und][1][value]" value="" size="60" maxlength="255" />
</div>
</div>
</td>
<td class="delta-order">
<div class="form-item form-type-select form-item-field-champ-multi-test-und-1--weight">
<label class="element-invisible" for="edit-field-champ-multi-test-und-1-weight">Weight for row 2 </label>
<select class="field_champ_multi_test-delta-order form-select" id="edit-field-champ-multi-test-und-1-weight" name="field_champ_multi_test[und][1][_weight]">
<option value="-1">-1</option>
<option value="0">0</option>
<option value="1" selected="selected">1</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="clearfix">
<input class="field-add-more-submit form-submit" type="submit" id="edit-field-champ-multi-test-und-add-more--2" name="field_champ_multi_test_add_more" value="Add another item" />
</div>
</div>
</div>
<!-- POST JSON data HTML code for a Drupal field with unlimited values (broken one) -->
<div class="form-item">
<div class="overflow-fix">
<table id="field-synonyms-values--2" class="field-multiple-table sticky-enabled">
<thead>
<tr>
<th colspan="2" class="field-label">
<label class="fel-field-label">Synonym(s) </label>
</th>
<th>Order</th>
</tr>
</thead>
<tbody>
<tr class="draggable odd">
<td class="field-multiple-drag"></td>
<td>
<div class="form-item form-type-textfield form-item-field-synonyms-und-0-value">
<input class="text-full form-text" type="text" id="edit-field-synonyms-und-0-value--2" name="field_synonyms[und][0][value]" value="synonym1" size="60" maxlength="255" />
</div>
</td>
<td class="delta-order">
<div class="form-item form-type-select form-item-field-synonyms-und-0--weight">
<label class="element-invisible" for="edit-field-synonyms-und-0-weight--2">Weight for row 1 </label>
<select class="field_synonyms-delta-order form-select" id="edit-field-synonyms-und-0-weight--2" name="field_synonyms[und][0][_weight]">
<option value="-1">-1</option>
<option value="0" selected="selected">0</option>
<option value="1">1</option>
</select>
</div>
</td>
</tr>
<tr class="draggable even">
<td class="field-multiple-drag"></td>
<td>
<div class="ajax-new-content">
<div class="form-item form-type-textfield form-item-field-synonyms-und-1-value">
<input class="text-full form-text" type="text" id="edit-field-synonyms-und-1-value" name="field_synonyms[und][1][value]" value="" size="60" maxlength="255" />
</div>
</div>
</td>
<td class="delta-order">
<div class="form-item form-type-select form-item-field-synonyms-und-1--weight">
<label class="element-invisible" for="edit-field-synonyms-und-1-weight">Weight for row 2 </label>
<select class="field_synonyms-delta-order form-select" id="edit-field-synonyms-und-1-weight" name="field_synonyms[und][1][_weight]">
<option value="-1">-1</option>
<option value="0">0</option>
<option value="1" selected="selected">1</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="clearfix">
<input class="field-add-more-submit form-submit" type="submit" id="edit-field-synonyms-und-add-more--2" name="field_synonyms_add_more" value="Add another item" />
</div>
</div>
<div class="better-descriptions description">Please enter basionyms and synonyms for the accepted name with Genus species authorities (one synonym per line). Click on Add another item to add a new synonym.
</div>

For the "broken" one, the second tr (draggable-even) is invisible (and missing in HTML Firebug console).
For the "good" one, the second tr is displayed and functional.

Thanks for any help.

Note : I have a "better description" on the broken field but I do not think it plays any role here.

cilefen’s picture

What module provides this field type?

toki’s picture

If I am correct, this is the core module Field.

cilefen’s picture

I think #2226665: Only set "add more" wrapper on fields with cardinality >1 is an opposite problem, which is the addition of your missing element when it is not needed. It would be good to know if there is any error logged on the server side, although I am beginning to doubt there would be one.

Is your local working site an accurate copy of the broken production site in terms of database and code?

toki’s picture

I know it sounds weird but I can not find any log errors when I triggered the Add another item button. And still the new input box does not appear.

When the production site has been published, I have made a migration (dump & Filezilla) to have a local version for further module update, etc. So the structure is similar. Only a few new values are missing on the local version and some CSS modifications (none related to the multi-value field mentioned here).

I do not know if it can be relevant but these fields are included in a fieldgroup (the production site broken field, the production site fresh working field and the local site working field). It seems like it has been a problem before :

The AJAX call is returning some JS settings but no HTML.

But in my case, even if I move the broken field out of the fieldgroup, it still does not work.

toki’s picture

Issue summary: View changes
droplet’s picture

Check the ajax responses.

toki’s picture

I have checked the ajax responses with Firebug console and Firefox console.
Everything is green, no errors.
Should I check something in particular?

When I click on Add another item, I get a POST method, file ajax, type json, with 3 objects (settings, insert, insert). Within the second object, the div with id mentioned before (field-fieldname-add-more-wrapper) is missing, compared to the working field.

cilefen’s picture

Is the POST-ed data the same in each case?

toki’s picture

Let's say that :

Field A = "broken" field on production site, created during summer 2015, Text type, unlimited values, depending on Field module

Field B = working field on production site, created after I noticed the issue (less than a month ago) on the same node form, same fieldgroup, Text type, unlimited values, depending on Field module

Field C = working field on local site, clone of field A from the production site when it got published (last january), Text type, unlimited values, depending on Field module.

If I click on Add another item for :

Field A : no effect on the form, no js errors, POST method, type json, 5 objects : settings, add_css, insert (js), insert (data HTML), insert

Field B : new input box, no js errors, POST method, type json, 3 objects : settings, insert (data HTML), insert
(no add_css and insert js because css and js already loaded?)

Field C : new input box, no js errors, POST method, type json, 5 objects : settings, add_css, insert (js), insert (dataHTML), insert

Tell me if you need more information or screenshots (I made a short screencast (30s) showing fields A and B behavior).

toki’s picture

Hello here, does anyone have any idea about this strange issue with multiple values core field in Drupal 7?
If not, does anyone can give me a simple way to clone a field and its values? Feeds? VBO? Features? something else?
Thanks in advance.

droplet’s picture

Category: Bug report » Support request

I don't think we can debugging in this way. You should figure out the problem source. Either from PHP or JS side (or modules). Or share us the raw data (eg. admin acc for testing, or full package)

https://developer.chrome.com/devtools/docs/javascript-debugging

toki’s picture

Usually, I work on Firefox and your comment reminds me that I did not try to see the Chrome console about this issue (an obvious mistake, sorry for that).
And indeed it could have been useful. The console shows this message now after I tried to add another item for Field A (broken one) :

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

Does it help to understand the problem source?
Thanks for your answer

EDIT : the message appears on local version for Field C (working)

toki’s picture

I suppose this message has no connection with this javascript problem...
Sorry for my lack of development skills but since I cannot find any error message, it is quite difficult to investigate.
I still can not understand why the Field A is broken and the new same Field B is working on the same Drupal structure.
Since no JS message appears, could it be CSS?

droplet’s picture

Checking this section for the response:
https://developer.chrome.com/devtools/docs/network#http-response

https://www.google.com/search?q=drupal+add+another+item+not+working&oq=d...
Many threads mentioned field_collection.

You can also compare 2 fields config. It must be some diff.

toki’s picture

Thanks for your answer.
Of course, I made many google search about that before pointing an issue here. Indeed Field Groups and Field Collection are often mentioned in answers but in my case, these modules do not seem to interfere. I have asked a question here too, a month ago, with these different related issues.
I will compare carefully the fields and as soon as I find something new, I will post here.

droplet’s picture

Take a backup and disabled these modules (or testing dev version) to test:

Field Groups and Field Collection

minax.de’s picture

Your screencast shows that the "broken" field has a name with brackets. Could you check whether your hosting provider blacklisted brackets in POST array indices with suhosin.request.array_index_blacklist? That would explain why it's working on your local copy and not the remote one.

This issue could be helpful: https://www.drupal.org/node/2665152#comment-11053097

toki’s picture

@minax.de, unfortunately, this field issue appears also for fields with no brackets in their name (I have a field named Temperature for example and it does not work either) but thank you for sharing this potential answer.
By the way, maybe it is worth mentioning that all the fields with multiple values created at the beginning (like Field A) are broken, while new ones (like Field B) are working (app. 10 broken fields, I only cited one because if I can fix one, I can fix many, I guess...)
I still need to try #21.

chaitanya17’s picture

Hi Toki,

Can you rebuild registry using drush command
drush eval "registry_rebuild();"
drush php-eval 'cache_clear_all("*", "cache", TRUE)'

IF "Aggregate JavaScript files" in the Performance configuration page is on, turned off to verify.

chaitanya17’s picture

Also provide log when you click on "Add another item" button

toki’s picture

Thanks for your answer.
I was away from keyboard but now I will have the time to test this option.
The Aggregate JavaScript files option is turned off on the production site.
So now I have #21 AND #24 to try.
I will keep you posted.

toki’s picture

I have tried to deactivate Field Group (Field Collection is not used in my website) but no results.
But I follow this idea with all the modules involved in Fields or Forms in the website and finally I think I found the solution.
When I deactivate the module "Better Field Descriptions" the "Add another item" action is working!
I will set everything precisely and get back here.
(Of course, it does not give any reason why this module broke the Javascript "Add another item" function...)

toki’s picture

It works.
Each multi-value field with a "better field description" below the option box was broken.
It seems like this module disables the new line creation or display.

Thanks everyone for your advices and clues, this forum always wins!
Greetings from France.

(I let you decide if this thread should be moved to Better Field Descriptions forum??)

droplet’s picture

Project: Drupal core » Better Field Descriptions
Version: 7.43 » 7.x-1.x-dev
Component: field system » Code
Category: Support request » Bug report
toki’s picture

Version: 7.x-1.x-dev » 7.x-1.0
sonvir249’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

Hi,
I don't think this is related to Javascript.
I have created a patch, this patch solves the issue of broken fields.

sonvir249’s picture

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar

  • Yogesh Pawar committed fa4e1e7 on 7.x-1.x authored by sonvir249
    Issue #2723339 by sonvir249, Toki, droplet, cilefen, chaitanya17, minax....
yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
Status: Needs review » Fixed

Committed & Pushed to 7.x-1.x branch.
Thanks @Toki @droplet @cilefen @chaitanya17 @minax.de & @sonvir249 working on this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.