0

Modal popup from submit not working after KO binding for input magento 2

I have working on form submit using popup to send email from homepage to checkout for that I have created popup which was working earlier with custom field in modal. phtml code below

<div style="display: none" class="start-trail-modal-popup">
    <h1><?php echo $block->escapeHtml(__('Start Your')) ?> <b>Free 14-DayTrail</b></h1>  
    <div class="left" data-bind="scope: 'customer'">
        <form id="free-trail-form" action="<?php echo $block->getFormAction() ?>" method="post">
            <fieldset class="fieldset">
                
                <!--  if user already logged in -->
                <?php if($block->isLoggedIn()): ?>
                    <?php //$customerEmail = $block->getEmail(); ?>
                 <?php endif; ?>

                <div class="field">
                    <label for="email" class="label">
                        <span><?php echo $block->escapeHtml(__('Email Address')) ?></span>
                    </label>
               
                    <div class="control">
                        <input data-validate="{required:true, 'validate-email':true}" type="email" id="email" class="input-text" <?php echo ($block->isLoggedIn()) ? 'disabled' : ''; ?>
                        data-bind="value: customer().email"
                        name ="email" placeholder="Enter your email address" />
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>

<script type="text/x-magento-init">
    {
    "*": {
        "Vendor_Module/js/product/config/provider": {
            "config": <?= /* @noEscape */ $block->getConfigData() ?>
        },
        "Vendor_Module/js/product/config/provider/generic-providers": {},
        "Vendor_Module/js/ajax-request": {
           "AjaxUrl": "<?= /* @noEscape */ $block->getFormAction() ?>"
        },
        "Vendor_Module/js/modal-popup": {
          "isCustomerLogin": "<?= /* @noEscape */ $block->isLoggedIn() ?>"
        },
        "Magento_Ui/js/core/app": {
          "components": {
              "customer": {
                "component": "Magento_Customer/js/view/customer"
              }
          }
        }
      }
    }
</script>

but form submit not working which I add ko binding in customer email input field

Your Answer

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

Browse other questions tagged or ask your own question.