Download & Extend

Addresses field settings are always reset to default values

Project:Addresses
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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 ...

Comments

#1

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

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

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

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

#5

coming in 1.06 ?

#6

Status:reviewed & tested by the community» fixed

Patch committed to the repository! Please remember it can take up to 12 hours before the dev snapshot is updated.

The issue described in #3 does appear to be a Firefox bug. The form displayed correctly on refreshes in Safari. Thanks all for the hard work. Get out there and test some more patches ;)

Cheers,

Antoine

#7

It lives! Nice to see that this module hasn't died after all, thanks Antoine.

#8

Status:fixed» closed (fixed)

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