La validación de formularios de Magento solo funciona en la última casilla de verificación de un grupo

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?

preguntado el 28 de mayo de 14 a las 14:05

¿Afecta la regulación de la esta publicación ¿¿ayuda?? -

thanks but still no joy :( -

intente agregar: class="radio validate-one-required organisation_type" to all 3 -

try validate-one-required-by-namefor all radio buttons -

neither of them work.. this is really bizarre.. i hate Magento sometimes -

2 Respuestas

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 enter image description here

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

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 or haz tu propia pregunta.