SimpleCart - Add header info onClick, Radio Buttons
<p>Im working on my cart using simpleCart and am new to javascript. I have been trying to get my form ('Colour_Check_Form')to work properly for days. The idea is the user clicks a radio button (colour_check) to select a colour. In short when the user adds the item to the cart I need to create the header item_Colour with the value from the for colour_check.</p>

<p>Here is the page (styling incomplete), click on the colours at the bottom to choose a colour and add item to cart. <a href="http://www.diysoakwells.com.au/downpipe.html" rel="nofollow">http://www.diysoakwells.com.au/downpipe.html</a></p>

<p>Hopefully someone can point me in the right direction as I have spent two days and nights on this and its probably pretty simple to those with the experience. I dont know how to format what im trying to acheive. </p>

<p>Im sure the problem lies in this script below as I have tested everything else and it works fine , I just cant work out the proper way of adding value ColourCheck to item_Colour--></p>

<pre><code>**&lt;!--CANT GET THIS TO WORK !!! --&gt;
&lt;a href="javascript:;" class="item_add"   onclick="simpleCart.add['item_Colour'].value[+getCheckedValue(document.forms['Colour_Check_Form'].elements['colour_check']);"&gt;Add&lt;/a&gt;**
</code></pre>

<p>I have put in a button to confirm the scripts are picking up the selected colour from the form:</p>

<pre><code>&lt;input type="button" onclick="alert('Checked value is: '+getCheckedValue(document.forms['Colour_Check_Form'].elements['colour_check']));" value="Show Checked Value"&gt;
</code></pre>

<p>Here is the rest of the relevant code--></p>

<p>Form:</p>

<pre><code>&lt;form name="Colour_Check_Form" method="get" action="" onsubmit="return false;"&gt;

        &lt;input type="radio" class="ColourCheck" name="colour_check" value="Woodland Grey" /&gt; 
</code></pre>

<p></p>

<p>Headers:</p>

<pre><code>&lt;script type="text/javascript"&gt;simpleCart.cartHeaders = ["Name" , "Price","increment_noHeader" ,"Quantity" , "decrement_noHeader" , "Total", "Colour"];
&lt;/script&gt;
</code></pre>

<p>Find Value of colur_check:</p>

<pre><code>&lt;script type="text/javascript"&gt;
function getCheckedValue(radioObj) {
if(!radioObj)
    return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
    if(radioObj.checked)
        return radioObj.value;
    else
        return "";
for(var i = 0; i &lt; radioLength; i++) {
    if(radioObj[i].checked) {
        return radioObj[i].value;
    }
}
return "";
</code></pre>

<p>}</p>

<pre><code>function setCheckedValue(radioObj, newValue) {
if(!radioObj)
    return;
var radioLength = radioObj.length;
if(radioLength == undefined) {
    radioObj.checked = (radioObj.value == newValue.toString());
    return;
}
for(var i = 0; i &lt; radioLength; i++) {
    radioObj[i].checked = false;
    if(radioObj[i].value == newValue.toString()) {
        radioObj[i].checked = true;
    }
}
</code></pre>

<p>}
    </p>
