I am using magento 1.9. In my custome module, In system.xml added field type checkboxes.

<show_featuredproduct translate="label">
    <label>Show Featured Product On</label>

I want to add validation for this field. I used <validate>validate-one-required</validate> but its not working. Any Idea?

  • Can you confirm whether Magento is adding the validate-one-required class to the checkbox elements? Aug 6 '14 at 14:11
  • @ColinO'Dell - class not added to the element.
    – Pandurang
    Aug 6 '14 at 14:30
  • @PMB I noticed a prodblem with varien form and checkbox validation recently. Have a look at magento.stackexchange.com/q/28524/158 Aug 6 '14 at 15:55
  • @DavidManners - I used getClass. It shows validation message for every checkbox. Yes there is problem with validation.
    – Pandurang
    Aug 7 '14 at 6:31
  • I used multiple select drop down instead of checkboxes
    – Pandurang
    Aug 7 '14 at 10:22

It's likely not working for 1 of 2 reasons:

1. The class isn't being applied to the input elements.

If this the case, try using <frontend_class>validate-one-required</frontend_class> instead, and see whether that applies the class.

2. The validate-one-required rule isn't working as expected.

You can try using validate-one-required-by-name instead, which Magento seems to use frequently with other sets of checkboxes.

Try one (or both) combinations, and hopefully that'll do the trick.

  • I tried both combinations not working
    – Pandurang
    Aug 6 '14 at 14:24
  • 1
    Try required-entry or validate-select
    – Manikandan
    Aug 6 '14 at 14:48

Try this if you want required field means


Refer this link Here

  • 1
    @Manikkandan I tried for both. Both not working. Seems there is problem with the multiple check box validation.
    – Pandurang
    Aug 7 '14 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.