Addresses field settings are always reset to default values

zedzed - March 25, 2009 - 08:19
Project:Addresses
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

In addresses settings page, a settings form that will allow admins to choose which addresses fields should be used don't work perfectly. If i choose "none" for some field and save it, when page is reloaded, this fields printed with default module value.
Code used to set default value (function _addresses_settings_fields):

'#default_value'  => empty($field_values[$ftype]) ? $field['display'] : $field_values[$ftype],

don't work because when value is "none", $field_values[$ftype] is 0, function empty() return true ...
This code should be work :
'#default_value'  => !isset($field_values[$ftype]) ? $field['display'] : $field_values[$ftype],

ps: i hope you understand my bad english ...

#1

goodeit - March 29, 2009 - 03:49
Status:active» reviewed & tested by the community

I have noticed the same issue, and this fix seems to work just fine. Thanks!

fyi: the problem is in /addresses/addresses.settings.inc line 305.

#2

dboulet - June 8, 2009 - 22:27
Title:wrong User addresses fields selection» Addresses field settings are always reset to default values
Version:6.x-1.05» 6.x-1.x-dev

I can confirm that the change presented above fixes the bug. Here's a patch.

AttachmentSize
addresses-HEAD_413088_form_defaults.patch 863 bytes

#3

gapple - July 24, 2009 - 22:19

Patch works well for initial page load, but upon refreshing the page in Firefox 3.5 the value of all radio button settings is shifted to the next (eg., Primary Address Checkbox changes from 'None' to 'Normal', then 'Required' on second refresh). Only occurs on a refresh, not a direct request to the url from the address bar.
I'm unable to test this behaviour in IE 8 right now.

Is this a separate issue? or caused outside of Addresses module?

#4

dboulet - July 27, 2009 - 15:54

@gapple, This could be a bug with Firefox's autocomplete feature, see http://www.ryancramer.com/journal/entries/radio_buttons_firefox/.

 
 

Drupal is a registered trademark of Dries Buytaert.