【问题标题】:Magento: How do I get the selected value from a group of radio buttons from a custom option?Magento:如何从自定义选项的一组单选按钮中获取选定的值?
【发布时间】:2012-08-22 15:23:19
【问题描述】:

我有一个自定义选项,其中包含 2 个选项。没有按钮组或 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>

谢谢!

【问题讨论】:

    标签: magento prototypejs


    【解决方案1】:

    我想它应该是某种形式。

    在 PrototypeJS 中,可以通过以下方式获取选中的单选按钮值:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-28
      • 1970-01-01
      • 2011-07-15
      • 2016-08-30
      • 2021-01-19
      • 1970-01-01
      相关资源
      最近更新 更多