0

Check this below code. I have added one checkbox on newsletter footer subscribe.phtml. If we are custom add checkbox on this then form submit without form fill up. Site Link : http://kkmag2.dev-site.me/

<form class="form subscribe"
          novalidate
          action="<?php /* @escapeNotVerified */
          echo $block->getFormActionUrl() ?>"
          method="post"
          data-mage-init='{"validation": {"errorClass": "mage-error"}}'
          id="newsletter-validate-detail">
        <div class="field newsletter">
                <input name="email" type="email" id="newsletter" class="form-control" placeholder="<?php /* @escapeNotVerified */
                echo __('Email address') ?>" data-validate="{required:true, 'validate-email':true}"/>
        </div>

        <div class="field input-box custom-required-checkbox">
            <input type="checkbox" title="<?php echo __('Sign Up for Newsletter') ?>" value="1" id="is_subscribed_footer" class="form-control checkbox required-entry" style="width: auto;" data-validate="{required:true}"/>
            <label for="is_subscribed_footer"><?php echo __("Yes, I would like to sign up to find out about Kilkenny's Exclusive Offers**") ?></label>
        </div>

        <div class="actions">
            <button class="btn-novetty action subscribe "
                     type="submit">
             <?php /* @escapeNotVerified */
                    echo __('Sign Up') ?>
            </button>
        </div>
    </form>
2
  • Have you get any error in console? – Chirag Patel Sep 28 '18 at 9:34
  • I have added name="dummy" and this works. – Pratik Kamani Sep 28 '18 at 9:45
1
<input type="checkbox" title="<?php echo __('Sign Up for Newsletter') ?>" name="dummy" value="" id="is_subscribed_footer" class="form-control checkbox required-entry" style="width: auto;" data-validate="{required:true}"/>

name field missing, name field is compulsory for validation.

1

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.