I have dynamic radio buttons. I've to get the value of selected radio button and value of hidden input type bound to it. I'm having one input type as hidden to pass option id using
<input type="radio" name="sareefinishing" value="<?php echo $opvalue->getTitle(); ?>" />
<input type="hidden" name="sareeOptionId" value="<?php echo $opvalue->getId(); ?>" />
Here is complete code:
foreach ($productCollection->getOptions() as $value) {
echo "Custom Option TITLE: <strong>" . $value->getTitle() . "</strong><br/>";
$values = Mage::getSingleton('catalog/product_option_value')->getValuesCollection($value);
foreach($values as $opvalue){
?>
<?php echo $opvalue->getTitle(); ?>
<input type="radio" name="sareefinishing" value="<?php echo $opvalue->getTitle(); ?>" />
<input type="hidden" name="sareeOptionId" value="<?php echo $opvalue->getId(); ?>" />
<?php
}
In my Javascript file I'm using following code
var data = $j('#customoption').serializeArray(); //customoption is form id
alert(data);
I'm getting correct selected label from radio button value from <?php echo $opvalue->getTitle(); ?>
but not it's corresponding value id from <?php echo $opvalue->getTitle(); ?>
. It gives all id values.