La validación de formularios de Magento solo funciona en la última casilla de verificación de un grupo
Frecuentes
Visto 4,152 equipos
2
I am using the built-in Magento form validation to ensure the user makes a selection on a particular group of radio boxes.
The code below looks fine however
<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>
Estoy usando el 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?
2 Respuestas
6
Necesitas agregar validate-one-required-by-name
to the last radio button.
<input type='radio' class="validate-one-required-by-name .. "
Eche un vistazo a Payment Method
when placing an admin order
Respondido 21 Oct 14, 13:10
Thanks R.S - that does indeed work the only downside I seem to have is the "Please select one of the options" error message in red appears 3 times (once under each radio button) - any ideas why it would display it 3 times? - zabs
Did you try to do a test with admin order creation? Did it you have one or multiple "Please select.." - Extensiones MagePal
1
You can't use the same ID in any case. Make your input id
attributes always different.
contestado el 28 de mayo de 14 a las 14:05
thanks although i have now made them unique and the problem persists :( - zabs
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript validation magento magento-1.7 or haz tu propia pregunta.
¿Afecta la regulación de la esta publicación ¿¿ayuda?? - eyoung100
thanks but still no joy :( - Zabs
intente agregar:
class="radio validate-one-required organisation_type"
to all 3 - eyoung100try
validate-one-required-by-name
for all radio buttons - MeenakshiSundaram Rneither of them work.. this is really bizarre.. i hate Magento sometimes - Zabs