I added a extra checkbox on register page, for terms and conditions, and i want to make it mandatory/required when i press on "create account" button.

this is my code:

<div class="register-button-custom">
        <label for="button">Do you agree?<a href="https://www.w3schools.com" >terms</a>
        <input type="checkbox" class="checkbox required-entry" id="register-input-custom" />

I already added this class for checkbox : checkbox required-entry but it's not working.

Does anyone have any idea how to make this checkbox mandatory?

2 Answers 2


data-validate="{required:true}" will do the trick

<div class="field choice newsletter">
        <label for="custom-terms" class="label"><span><?php /* @escapeNotVerified */ echo __('Do you agree ?') ?></span></label>
        <input type="checkbox" data-validate="{required:true}" name="custom-terms" title="<?php /* @escapeNotVerified */ echo __('Terms and contitions') ?>" id="register-input-custom" class="checkbox">
  • Glad to hear that. Good luck ! Mar 2, 2017 at 14:51
  • 4
    i did the same but not working i can't see error message. Jan 1, 2018 at 7:09
  • 2
    This does appear to make the input required, but shows no feedback when you leave it unchecked.
    – ACJ
    Aug 12, 2019 at 8:46
  • 1
    I have the same issue it doesn't show error message has anyone solved it ?
    – Prits
    Sep 3, 2020 at 10:21
  • @SarfarajSipai I figured out why it does not show the error message. Here is my solution: magento.stackexchange.com/a/338134/66769 (please upvote if it helps)
    – Black
    Jun 2, 2021 at 8:36

As you are creating a custom field. I think use of this code will work for you:

<li class="control">
     <div class="input-box">
       <input type="checkbox" id="privacy_policy" name="privacy_policy" value="1" title="<?php echo $this->__('Accept the privacy policy') ?>" class="checkbox required-entry">
    <label for="is_subscribed"><?php echo $this->__('Accept the privacy policy') ?> (<a href="<?php echo Mage::helper('cms/page')->getPageUrl( 6 ) ?>"><?php echo $this->__('privacy policy'); ?></a>)</label>

You can do text changes as per your requirement.

  • are you sure that it's not for magento 1? Mar 2, 2017 at 13:52

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.