Forums / Bug Reports / [not a bug] Label missing on radio field if only one attribute is available

[not a bug] Label missing on radio field if only one attribute is available

Locked

Started by dsided on 21 Sep 2008, 1:29 AM · Views: 1,855

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
21 Sep 2008, 1:29 AM
#1
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

[not a bug] Label missing on radio field if only one attribute is available

I think it's a bug as all form items need to have labels for accesibility (screen readers)

zc1.3.8a

modules/attributes.php

line 564

$options_name[] = $products_options_names->fields['products_options_name'];
```Should be replaced with
```php
$options_name[] = '<label class="attribsRadioButton" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options_names->fields['products_options_name'] . '</label>';

John Crumpton, Technical Director of Double Sided
Zen cart shop: Buy happie loves it

22 Sep 2008, 8:13 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: [not a bug] Label missing on radio field if only one attribute is available

Did you encounter a particular product attribute configuration which rendered an incorrect display? If so, please explain the exact configuration so it can be reproduced for proper evaluation.

Or are you just analyzing code?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Sep 2008, 8:17 AM
#3
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

Re: [not a bug] Label missing on radio field if only one attribute is available

This is when a drop down attribute is set, for example Colour, and only one colour is entered, for example blue. Instead of rendering a drop down, the attribute option (blue) is shown as a selected radio option.

John Crumpton, Technical Director of Double Sided
Zen cart shop: Buy happie loves it

22 Sep 2008, 8:35 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: [not a bug] Label missing on radio field if only one attribute is available

Using 1.3.8a with demo data, I selected "Test Eight" as the product, then added the "Documentation" (a [Dropdown] option) and "MS Word" for the value.

The resultant HTML in the template renders as: ```html
<input type="radio" name="id[17]" value="63" checked="checked" id="attrib-17-63" /><label class="attribsRadioButton" for="attrib-17-63">MS Word - English</label>

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Sep 2008, 8:45 AM
#5
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

Re: [not a bug] Label missing on radio field if only one attribute is available

Sorry Dr Byte, you're right this isn't a bug. In your test example "Documentation" is wrapped in a h4 when the only item is MS Word, however if you add another attribute, "MS Excel", "Documentation" is now wrapped in a label. I noticed this change as I had styled form labels, and when only one attribute appears there wasn't a label to take the formatting. Thanks for looking into this and hope I didn't waste your time.

John Crumpton, Technical Director of Double Sided
Zen cart shop: Buy happie loves it