2012-08-22 28 views
0

我有一個自定義選項,其中包含2個選項。沒有按鈕組或Magento創建的按鈕組,單選按鈕和標籤都在< ul>中,那麼如何獲得所選的單選按鈕?這是代碼:Magento:我如何從自定義選項中的一組單選按鈕中獲取所選值?

<ul id="options-22-list" class="options-list"> 
    <li> 
     <input id="options_22_2" class="radio validate-one-required-by-name product- custom-option" type="radio" price="6.8" value="40" name="options[22]" onclick="opConfig.reloadPrice()"> 
     <span class="label"> 
      <label for="options_22_2"> 
       option1 
       <span class="price-notice"> 
        + 
        <span class="price">€6.80</span> 
        </span> 
      </label> 
      </span> 
    </li> 
    <li> 
     same as above just with the other option and other ids 
    </li> 
</ul> 

謝謝!

回答

1

我想它應該是某種形式。

在PrototypeJS,你可以得到所選擇的單選按鈕值:

var radioValue = Form.getInputs('myform','radio','options[22]').find(function(radio) { 
    return radio.checked; 
}).value; 
+0

我會盡力的,謝謝! – user1540714

相關問題