Closed (fixed)
Project:
Address Field
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2011 at 16:02 UTC
Updated:
19 May 2013 at 08:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
flortjes commentedNote that this would also fix issue #1224562: Theming Address Field form is difficult
Comment #2
David D commentedHas this been committed to the current release?
Comment #3
mrfelton commentedMuch better. Thanks.
Comment #4
geerlingguy commentedClosed #1224562: Theming Address Field form is difficult and moving my 'follow' over here. Patch is definitely RTBC by me as well. This is quite annoying for those who want vertical alignment of the fields; there is literally no way to adjust spacing in CSS. (Maybe some really hackish ways using line heights and such, but that's just wrong.
Comment #5
damien tournoud commentedHow does this affect rendering of addresses? (ie. the formatting part?) The renderable array is used for both.
Comment #6
geerlingguy commentedUpdated patch against latest -dev release (old patch wasn't working).
Comment #7
geerlingguy commentedIt's for the form, and not the rendered address. For example, if I want to line up the form field elements vertically, strange gaps appear between city/state/zip (american... really locality, province, postal or whatever):
See my notes in #1224562: Theming Address Field form is difficult for more.
Comment #8
geerlingguy commented...and if I apply the patch, then those spaces are gone, meaning I can actually space the form elements myself using CSS - padding, margins, etc. Before, I'd have to adjust line heights in weird ways, or use negative margins to get fields to line up. And I'd have to do that on labels and fields.
Example after patch applied:
Comment #9
magicmyth commentedI've just run into this issue when styling the forms but it is not something a simple space character should cause so I looked into the code and found the prefixes were not actually using a normal space character but some other funky unicode character. The browsers try to deal with this as best they can and creates a element which inherits all kinds of styling.
My guess is this is an accident by the author probably from pasting the text from somewhere else and the character not showing in the author's text editor. For example, gedit does not show the character (just white space) but kate does. If you simply delete the character and put in a correct unicode space it should work fine in the browsers (a normal whitespace should not influence block elements nor inherit style).
If you are curious what the character is you can see it mapped in Drupal in the file includes/unicode.entities.inc line 135.
The addressfield author may have done this for a deliberate reason though as it has been used for prefixes throughout (including the name field (name-full.inc) plugin). If so I would like to know the reason?
If this issue is causing you problems and you don't want to edit the modules code you can probably work around it in your theme using either a form alter and editing the prefix or possibly in a pre-process. I've not yet attempted this though.
Hope you find this info useful?
Comment #10
fearlsgroove commentedAttached patch handles the render version better, adds a comma after city for US addresses, and fixes a bug exposed by this change where '#prefix' should have been '#field_prefix', which doubled the prefix value. Tested in garland and a few custom themes. Without additional styling by a theme, things should look identical pre and post patch in both render and form mode, but the prefixes are gone which makes stacked addressfields trivial.
Comment #11
muschpusch commentedSorry really short on time but the patch doesn't fix:
plugins/format/name-full.inc still an ascii something
Comment #12
markabur commentedThanks, #10 works for me to remove the extra space within City - State - Zipcode, and the comma after city is a good change. Tested in an Omega subtheme.
Comment #13
Anonymous (not verified) commentedThanks for the patch! I can confirm w/ markabur that #10 works. Also tested in an Omega subtheme.
Comment #14
fearlsgroove commentedPatch still applies, RTBC based on 12/13. Addresses should be visually no different either when rendered or displayed as a form/widget, but should be much easier to style at the theme layer.
Comment #15
pounardThis patch is missing some occurences, in actual version there are 4 non breakable whitespaces:
in plugins/format/address.inc: lines 61, 88 and 362
in plugins/format/name-full.inc: line 36
(the last one is missing)
Comment #16
henrijs.seso commented#10 is mostly good
, except this code at the end of address.inc This adds space to postal code that might not be entered in form making space before city in address. There should be check if data exists before inserting prefix.Patch could be updated with checking not only if mode == render but also if field to be rendered before current field is not empty, this would remove spaces in beginning of address lines.
Comment #17
timodwhit commentedGreat Patch, helped a lot and made the form so pretty! :-)
Are their plans on rolling this into the next release?
Comment #18
iamEAP commentedAny chance we can get this committed and create a followup task for mansspams concerns in #16?
I'm utilizing #10 and it works wonderfully.
Comment #19
johnpitcairn commentedAck, yes, can we have this committed please?
Comment #20
milesw commentedI can also confirm that #10 solves the extra whitespace issue.
Comment #21
stevieb commented#10 also fixed the issue for me
Comment #22
johnpitcairn commentedA word from the module maintainers at this point might be good. About to go live with the patched version here.
What, if anything, is this waiting on? Do we need to roll another patch to address #11/15/16, or can we handle those in a followup?
Comment #23
fearlsgroove commentedThis is a re-roll that applies cleanly. @magicmyth also had a good point -- the reason whitespace matters at all here (normally it doesn't) is that the current code is using non-breaking spaces instead of normal spaces. This patch just replaces with normal spaces, which produces the same effect without making it impossible to "unfloat" cleanly.
Also still fixes the double prefix bug -- there's another patch for this here but those patches are wrong as they mix up #prefix and #field_prefix
Comment #24
barrapontoWorks as advertised :)
Comment #25
andyg5000#23 Works great for me. Just need to update the space prefix in plugins/format/name-full.inc to fix name form when using separate first and last name fields. Thanks!
Comment #26
barraponto@andyg5000 can you elaborate? is there something else that is needed for this patch to be commited?
Comment #27
nelslynn commentedAre the spaces (nbsp;'s) going to be removed after the first name, city and state? Spacing should not be included here. It makes for very inflexible styling of an address. Spacing such as this can be accomplished with CSS, and shouldn't be hard coded.
Status regarding this?
Comment #28
fearlsgroove commentedUpdating to fix the prefix on last name as well.
Comment #29
andyg5000I've had to use this on the past two projects. Please commit :) R&TBTC
Comment #30
k4v commented#28 works for me =)
Comment #31
Loac commentedFor example, you can use custom module and hook_form_alter().
Comment #32
chi commentedAs stated in #9 it isn't a space.
Comment #33
johnvMarked these issues as (possible) duplicates:
#1945600: #field_prefix/#prefix behavior broken, inconsistent with #field_suffix/#suffix in rendered addresses
#1410612: Double #prefix problem
#1482802: Prefix Duplication in plugin
Also: this issue started as a 'space' issue, and #10 introduced the 'prefix' issues, which is already treated in the above issues.
Are we sure we aren't discussing 2 different issues?
Comment #34
Garrett Albright commentedI started #1945600: #field_prefix/#prefix behavior broken, inconsistent with #field_suffix/#suffix in rendered addresses after encountering the prefix issue which #28 will fix. Would love to see this patch make it into the project. What's the current hold-up? I don't see one on this issue since #28 was posted… I'd be glad to help tackle it.
Comment #35
rszrama commentedCommitted #28. I like how this one got sent back to RTBC after being reverted to needs work without the extra work being addressed. : P
In any event, sorry it took so long, and kudos to fearlsgroove for sticking with it long enough to get us to a good patch. Thanks to folks for reviewing and posting the success, too. : )
Commit: http://drupalcode.org/project/addressfield.git/commitdiff/bc78ab0
Comment #37
aidanlis commentedIf you want to remove the inline class without touching the styling: