PDA

View Full Version : Radio Button Click Does Not Update Text in IE


kitsch
02-18-2009, 08:25 PM
http://globalconsultancy.net/Kinetic/customisation.php?machine_id=1&sku=1

if this is viewed in Firefox or Safari, when a user selects between different processors the price and 'included in cost' tag is automatically appended to the each of each one.

however, viewed in IE it does the opposite. for an example, change processors three times.

i'm at a loss as to how to fix this and numerous hours of sleep have been lost. please help!

abduraooft
02-19-2009, 08:39 AM
IE gives and error, when the execution reaches
var subid = this.parentNode.getAttribute('for').split("_");
... is null or not an object

Anyway, it's always a good practice to rectify all errors in the markup (http://validator.w3.org/check?uri=http%3A%2F%2Fglobalconsultancy.net%2FKinetic%2Fcustomisation.php%3Fmachine_id%3D1%26sku%3D 1&charset=%28detect+automatically%29&doctype=Inline&group=0), when using complex javascript operations.

kitsch
02-19-2009, 10:16 AM
hi there,

yep, I found the error myself and have been tryingto replace with


document.getElementById


but that doesn't seem to work. I need something that cab read the value of the 'for' attribute of a label (look at the markup for processors).

any ideas are much appreciated

abduraooft
02-19-2009, 10:32 AM
Have a look at http://www.quirksmode.org/bugreports/archives/2005/09/getAttributefor_returns_null.html

kitsch
02-19-2009, 11:06 AM
Have a look at http://www.quirksmode.org/bugreports/archives/2005/09/getAttributefor_returns_null.html

the link that page mentions as an example, doesn't work. and apparently Safari won't support attributes["for"].value

htmlFor will work according to the quotes mentioned, but i'm not sure how best to implement it?

abduraooft
02-19-2009, 12:27 PM
I know it's not the correct solution, though how about
<label for="processor_10" class="processor_10">..... and
var subid = this.parentNode.className.split("_");?

kitsch
02-19-2009, 12:37 PM
i was thinking that, but couldn't quite figure out how to access the class. the class name and for attribute will always marry up though.

when I try this, it then throws an error


Line: 83
Char: 4
Error: 'PRICE(...)' is null or not an object.
Code: 0


i'm just working through PRICE now to see if there's maybe an error in the parameters.

kitsch
02-19-2009, 12:41 PM
when I inspect the contents of subid using


alert(subid)


i get a blank alert box. is there anyway to see the value being assigned to this.parentNode.className.split("_"); ?

abduraooft
02-19-2009, 01:17 PM
It worked(got the correct alerts) for me for
var subid = this.parentNode.className.split("_");
alert(subid);
and
<p><input name="processor" value="2" id="processor_10" type="radio">
<label for="processor_10" class="processor_10">Intel Core 2 Duo E4600<span class="price-change-box included" id="price-change-box-processor_10">[included in total cost]</span></label></p>
<p><input name="processor" value="3" id="processor_11" type="radio">
<label for="processor_11" class="processor_11">Intel Core 2 Duo E7300<span class="price-change-box adjust" id="price-change-box-processor_11">[ $3]</span></label></p>
<p><input name="processor" value="4" id="processor_12" checked="checked" type="radio">
<label for="processor_12" class="processor_12">Intel Core 2 Duo E4700<span class="price-change-box adjust" id="price-change-box-processor_12">[ $25]</span></label></p>
<p><input name="processor" value="6" id="processor_13" type="radio">
<label for="processor_13" class="processor_13">Intel Core 2 Duo E8200<span class="price-change-box adjust" id="price-change-box-processor_13">[ $44]</span></label></p>

kitsch
02-19-2009, 01:31 PM
if you could have a look at the code here:

http://kineticuk.com/Pilot/customisation.php?machine_id=1&promo_id=1

you'll see it throws an error straight away. something to do with the PRICE object, similiar to the piece of code I posted earlier

i've made all the changes you suggested. any ideas why this isn't working here?


thanks again

abduraooft
02-19-2009, 02:25 PM
I haven't checked the working/logic of your script/page, but here is a copy of your page at my end (saved from browser's Ctrl+S option)

(see the attached zip)

kitsch
02-19-2009, 02:32 PM
thanks.

i've uploaded it to my server but, surprise surprise, it still doesn't work. ( http://kineticuk.com/Pilot/customisation.php?machine_id=1&promo_id=1 )
the text for processors and ram etc, isn't being generated. you'll notice it also doesn't work correctly in FF now. sorry for all this hassle but you've been a big help so far & i think it's nearly fixed!

kitsch
02-19-2009, 02:57 PM
if it helps you can view an alternative design here:

http://alienware.co.uk/configurator_pages/aurora_r5.aspx?SysCode=PC-EU-AURORA-R5&SubCode=SKU-DEFAULT