Closed (fixed)
Project:
Button Field
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2011 at 22:24 UTC
Updated:
8 Jul 2012 at 20:00 UTC
Leaving the confirmation message field empty on the settings page doesn't seem to be working correctly. I'm seeing an array of empty strings being set in my Drupal settings.
jQuery.extend(Drupal.settings, { "basePath": "/secure/programreview/", "field_button_submit-1803": { "confirmation": [ "", "" ] }, "activePath": "/secure/programreview/", "getQ": "node/1803" });
We put a few debug statements in the module and saw that drupal_add_js($settings, 'setting'); is being called twice.
As a quick fix, we changed
Drupal.settings[id].confirmation
to
$.isArray(Drupal.settings[id].confirmation) ? Drupal.settings[id].confirmation[0] : Drupal.settings[id].confirmation;
I looked through previous issues, but those all seem to be caused by other messaging modules interfering and we aren't using any.
Comments
Comment #1
FranckV commentedHi sprinkles, thank you for the quick fix proposal. I have the exact same issue. However, I don't really understand your final code. Sorry...
The pattern
Drupal.settings[id].confirmationis only available in the last three lines of thebutton_field.jscode :But I can't make it work... What would the corrected code look like ?
Thanks
Comment #2
sprinkles commentedWe changed the code you posted to the following:
I put it in a variable to make it easier to read.
Also, I suggested that it's a "quick fix" because this isn't really solving the problem. The way the confirmation message is being set to begin with possibly needs some work in the module code.
Comment #3
BassistJimmyJam commentedThe confirmation should always be a string and never an array, so doing an isArray() check is not necessary. I have not been able to reproduce your issue; however, I have made some changes in f6128dc that should ensure the confirmation message is never shown when it is not set.
Comment #4
tbroberg commentedWe had this issue, and the fixes introduced in the 3/26 6.x-1.x-dev seem to have resolved it.
Thanks, BJJ.
- Tim.