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.
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | 2723339-31.patch | 1.57 KB | sonvir249 |
| add-another-item-2.png | 24.53 KB | toki | |
| add-another-item-1.png | 9.35 KB | toki |
Comments
Comment #2
tokiComment #3
cilefen commentedWhat is logged by Drupal and the PHP error log?
Comment #4
tokiThe 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.
Comment #5
tokiI 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 :
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.
Comment #6
cilefen commentedWhat module provides this field type?
Comment #7
tokiIf I am correct, this is the core module Field.
Comment #8
cilefen commentedI 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?
Comment #9
tokiI 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 :
But in my case, even if I move the broken field out of the fieldgroup, it still does not work.
Comment #10
tokiComment #11
droplet commentedCheck the ajax responses.
Comment #12
tokiI 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.
Comment #13
cilefen commentedIs the POST-ed data the same in each case?
Comment #14
tokiLet'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).
Comment #15
tokiHello 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.
Comment #16
droplet commentedI 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
Comment #17
tokiUsually, 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)
Comment #18
tokiI 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?
Comment #19
droplet commentedChecking 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.
Comment #20
tokiThanks 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.
Comment #21
droplet commentedTake a backup and disabled these modules (or testing dev version) to test:
Field Groups and Field Collection
Comment #22
minax.de commentedYour 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
Comment #23
toki@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.
Comment #24
chaitanya17 commentedHi 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.
Comment #25
chaitanya17 commentedAlso provide log when you click on "Add another item" button
Comment #26
tokiThanks 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.
Comment #27
tokiI 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...)
Comment #28
tokiIt 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??)
Comment #29
droplet commentedComment #30
tokiComment #31
sonvir249 commentedHi,
I don't think this is related to Javascript.
I have created a patch, this patch solves the issue of broken fields.
Comment #32
sonvir249 commentedComment #33
yogeshmpawarComment #35
yogeshmpawarCommitted & Pushed to 7.x-1.x branch.
Thanks @Toki @droplet @cilefen @chaitanya17 @minax.de & @sonvir249 working on this issue.