Thanks for the quick response!
I actually did work out another way to do this using js. It was a few hours mucking around, but for anyone trying to do a similar thing I did the following:
1. make the attribute labels all be radio buttons
2. Use CSS to hide the radio buttons of the attributes you just want to be labels, leave one attribute displaying its radio buttons for the user to select from
3. onsubmit of the form call a js function that checks which radio button was selected and the change its corresponding hidden radio buttons to be selected as well.
HTML Code:
<script language="JavaScript">
<!--
function selectAttributes()
{
var j = 0;
var aryClassElementsPrice = getElementsByClassName( 'class4', document.body );
var aryClassElementsSize = getElementsByClassName( 'class5', document.body );
var aryClassElementsName = getElementsByClassName( 'class2', document.body );
for(i=0; i<aryClassElementsPrice.length; i++)
{
if(aryClassElementsPrice[i].checked==true)
{
aryClassElementsSize[i].checked = true;
aryClassElementsName[i].checked = true;
j++;
}
}
if(j == 0)
{
alert("Please select a size");
}
else
{
document.cart_quantity.submit();
}
}
function getElementsByClassName( strClassName, obj ) {
var ar = arguments[2] || new Array();
var re = new RegExp("\\b" + strClassName + "\\b", "g");
if ( re.test(obj.className) ) {
ar.push( obj );
}
for ( var i = 0; i < obj.childNodes.length; i++ )
getElementsByClassName( strClassName, obj.childNodes[i], ar );
return ar;
}
//-->
</script>
Bookmarks