Magento表单验证仅适用于组中的最后一个复选框 [英] Magento form validation only works on the last checkbox in a group
问题描述
我正在使用内置的Magento表单验证,以确保用户在特定的一组广播框中进行选择。
I am using the built-in Magento form validation to ensure the user makes a selection on a particular group of radio boxes.
下面的代码看起来不错
<div class="input-box">
<li class="control">
<input type="radio" class="radio organisation_type" value="1" id="billing:organisation_type_1" name="billing[organisation_type]"> <?php echo $this->__('School') ?></li>
<li class="control">
<input type="radio" class="radio organisation_type" value="2" id="billing:organisation_type_2" name="billing[organisation_type]"> <?php echo $this->__('Parent') ?></li>
<li class="control">
<input type="radio" class="radio validate-one-required organisation_type" value="3" id="billing:organisation_type_3" name="billing[organisation_type]"> <?php echo $this->__('Business') ?></li>
</div>
我在最后一节课上使用 validate-one 方法收音机盒
I am using the validate-one method on the class on the last radio box
由于某些原因,如果我选择最后一个收音机盒,上面的代码只会让我继续?任何人都可以解释为什么如果我检查第一个或第二个框验证仍然失败?
For some reason the code above will only let me proceed if I select the last radio box?? Can anyone explain why if I check either the first or second box the validation is still failing?
推荐答案
您需要添加 validate-one-required-by-name
到最后一个单选按钮。
You need to add validate-one-required-by-name
to the last radio button.
<input type='radio' class="validate-one-required-by-name .. "
查看付款方式
发出管理订单时
Take a look at Payment Method
when placing an admin order
这篇关于Magento表单验证仅适用于组中的最后一个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!