jQuery validation not working on pressing enter key in Magento2.2.5?Magento2 - Add new field to new step in magento 2!Magento 2 Checkout not showing all fieldsReview/Rating Spam Protection in Magento 2Magento 2 Add new field to Magento_User admin formCheckout Form - How to wrap multiple elements in a class - Magento 2Magento 2: How to submit form on checkbox click?How to make file field required pass when submit even it existed valuehow to add category using factory method not object managerMagento 2 How to set value to UI component hidden field using Jquery or JavascriptMagento 2: Custom input field values not saved in product form

Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?

Is there an online compendium of Rav Moshe teshuvos in English that exists?

Forgetting the musical notes while performing in concert

Different meanings of こわい

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

How badly should I try to prevent a user from XSSing themselves?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

How can a day be of 24 hours?

How do conventional missiles fly?

What Exploit Are These User Agents Trying to Use?

Avoiding the "not like other girls" trope?

Ambiguity in the definition of entropy

Knowledge-based authentication using Domain-driven Design in C#

Should I tell management that I intend to leave due to bad software development practices?

In the UK, is it possible to get a referendum by a court decision?

Can I hook these wires up to find the connection to a dead outlet?

Was the Stack Exchange "Happy April Fools" page fitting with the '90's code?

How obscure is the use of 令 in 令和?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Unlock My Phone! February 2018

"the same as" in a sentence

Can compressed videos be decoded back to their uncompresed original format?

What exactly is ineptocracy?



jQuery validation not working on pressing enter key in Magento2.2.5?


Magento2 - Add new field to new step in magento 2!Magento 2 Checkout not showing all fieldsReview/Rating Spam Protection in Magento 2Magento 2 Add new field to Magento_User admin formCheckout Form - How to wrap multiple elements in a class - Magento 2Magento 2: How to submit form on checkbox click?How to make file field required pass when submit even it existed valuehow to add category using factory method not object managerMagento 2 How to set value to UI component hidden field using Jquery or JavascriptMagento 2: Custom input field values not saved in product form













0















I have used jQuery validation, but it is not working on pressing enter key in Magento2.2.5?



But works on Submit button.



Refer my code.



<?php
?>
<div class="row margincontrol">
<form class="form"
id="custom-form"
method="post"
action="<?php echo $block->getBaseUrl().'warranty/index/result' ?>"
autocomplete="off">

<fieldset class="fieldset">
<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="first_name" class="label"><span class="font_app"><?php echo __('First Name') ?></span></label>
<div class="control">
<input type="text" name="first_name" id="first_name" class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="last_name" class="label boxspaing"><span class="font_app"><?php echo __('Last Name') ?></span></label>
<div class="control boxspaing">
<input type="text" name="last_name" id="last_name" class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="email" class="label"><span class="font_app"><?php echo __('Email') ?></span></label>
<div class="control">
<input type="text" name="email" id="email" class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="phone_no" class="label boxspaing"><span class="font_app"><?php echo __('Telephone') ?></span></label>
<div class="control boxspaing">
<input type="text" name="phone_no" id="phone_no" maxlength ="10"
class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="address1" class="label"><span class="font_app"><?php echo __('Address 1') ?></span></label>
<div class="control">
<input type="text" name="address1" id="address1"
class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field address2">
<label for="address2" class="label boxspaing"><span class="font_app"><?php echo __('Address 2') ?></span></label>
<div class="control boxspaing">
<input type="text" name="address2" id="address2"
class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="city" class="label"><span class="font_app"><?php echo __('City:') ?></span></label>
<div class="control">
<input type="text" name="city" id="city" class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-6 col-lg-6 field required">
<label for="postcode" class="label"><span class="font_app"><?php echo __('Zipcode') ?></span></label>
<div class="control">
<input type="text" name="postcode" id="postcode" class="input-text" value="">
</div>
</div>

<div class="col-sm-12 col-md-12 col-lg-12">
<div class="actions-toolbar">
<div class="primary">
<button type="submit" class="action submit primary" id="sub_btn" title="<?php echo __('Submit') ?>">
<span><?php echo __('Submit') ?></span></button>
</div>
</div>
</div>

</form>
</div>
</div>

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script type="text/javascript">
require([
'jquery'
], function($)

jQuery(document).ready(function()
jQuery("#custom-form").validate(
rules:
first_name: "required",
last_name: "required",
email:
required: true,
email: true
,
phone_no:
required:true,
number:true
,
address1: "required",
city: "required",
region: "required",
postcode: "required"
,
messages:
first_name: "Please enter your Firstname",
last_name: "Please enter your Lastname",
email: "Please enter a valid Email Address",
phone_no:
required: "Please enter your Phone Number",
number:"Please enter numbers Only"
,
address1: "Please enter your Address",
city: "Please enter your City",
region: "Please enter your State/Province",
postcode: "Please enter your Zipcode"
,
submitHandler: function(form)
//event.preventDefault();
// alert("Do some stuff...");
form.submit();
return false;
//submit via ajax


);
);
);
</script>


Any help would be appreciated.










share|improve this question


























    0















    I have used jQuery validation, but it is not working on pressing enter key in Magento2.2.5?



    But works on Submit button.



    Refer my code.



    <?php
    ?>
    <div class="row margincontrol">
    <form class="form"
    id="custom-form"
    method="post"
    action="<?php echo $block->getBaseUrl().'warranty/index/result' ?>"
    autocomplete="off">

    <fieldset class="fieldset">
    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="first_name" class="label"><span class="font_app"><?php echo __('First Name') ?></span></label>
    <div class="control">
    <input type="text" name="first_name" id="first_name" class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="last_name" class="label boxspaing"><span class="font_app"><?php echo __('Last Name') ?></span></label>
    <div class="control boxspaing">
    <input type="text" name="last_name" id="last_name" class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="email" class="label"><span class="font_app"><?php echo __('Email') ?></span></label>
    <div class="control">
    <input type="text" name="email" id="email" class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="phone_no" class="label boxspaing"><span class="font_app"><?php echo __('Telephone') ?></span></label>
    <div class="control boxspaing">
    <input type="text" name="phone_no" id="phone_no" maxlength ="10"
    class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="address1" class="label"><span class="font_app"><?php echo __('Address 1') ?></span></label>
    <div class="control">
    <input type="text" name="address1" id="address1"
    class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field address2">
    <label for="address2" class="label boxspaing"><span class="font_app"><?php echo __('Address 2') ?></span></label>
    <div class="control boxspaing">
    <input type="text" name="address2" id="address2"
    class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="city" class="label"><span class="font_app"><?php echo __('City:') ?></span></label>
    <div class="control">
    <input type="text" name="city" id="city" class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-6 col-lg-6 field required">
    <label for="postcode" class="label"><span class="font_app"><?php echo __('Zipcode') ?></span></label>
    <div class="control">
    <input type="text" name="postcode" id="postcode" class="input-text" value="">
    </div>
    </div>

    <div class="col-sm-12 col-md-12 col-lg-12">
    <div class="actions-toolbar">
    <div class="primary">
    <button type="submit" class="action submit primary" id="sub_btn" title="<?php echo __('Submit') ?>">
    <span><?php echo __('Submit') ?></span></button>
    </div>
    </div>
    </div>

    </form>
    </div>
    </div>

    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
    <script type="text/javascript">
    require([
    'jquery'
    ], function($)

    jQuery(document).ready(function()
    jQuery("#custom-form").validate(
    rules:
    first_name: "required",
    last_name: "required",
    email:
    required: true,
    email: true
    ,
    phone_no:
    required:true,
    number:true
    ,
    address1: "required",
    city: "required",
    region: "required",
    postcode: "required"
    ,
    messages:
    first_name: "Please enter your Firstname",
    last_name: "Please enter your Lastname",
    email: "Please enter a valid Email Address",
    phone_no:
    required: "Please enter your Phone Number",
    number:"Please enter numbers Only"
    ,
    address1: "Please enter your Address",
    city: "Please enter your City",
    region: "Please enter your State/Province",
    postcode: "Please enter your Zipcode"
    ,
    submitHandler: function(form)
    //event.preventDefault();
    // alert("Do some stuff...");
    form.submit();
    return false;
    //submit via ajax


    );
    );
    );
    </script>


    Any help would be appreciated.










    share|improve this question
























      0












      0








      0








      I have used jQuery validation, but it is not working on pressing enter key in Magento2.2.5?



      But works on Submit button.



      Refer my code.



      <?php
      ?>
      <div class="row margincontrol">
      <form class="form"
      id="custom-form"
      method="post"
      action="<?php echo $block->getBaseUrl().'warranty/index/result' ?>"
      autocomplete="off">

      <fieldset class="fieldset">
      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="first_name" class="label"><span class="font_app"><?php echo __('First Name') ?></span></label>
      <div class="control">
      <input type="text" name="first_name" id="first_name" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="last_name" class="label boxspaing"><span class="font_app"><?php echo __('Last Name') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="last_name" id="last_name" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="email" class="label"><span class="font_app"><?php echo __('Email') ?></span></label>
      <div class="control">
      <input type="text" name="email" id="email" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="phone_no" class="label boxspaing"><span class="font_app"><?php echo __('Telephone') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="phone_no" id="phone_no" maxlength ="10"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="address1" class="label"><span class="font_app"><?php echo __('Address 1') ?></span></label>
      <div class="control">
      <input type="text" name="address1" id="address1"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field address2">
      <label for="address2" class="label boxspaing"><span class="font_app"><?php echo __('Address 2') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="address2" id="address2"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="city" class="label"><span class="font_app"><?php echo __('City:') ?></span></label>
      <div class="control">
      <input type="text" name="city" id="city" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="postcode" class="label"><span class="font_app"><?php echo __('Zipcode') ?></span></label>
      <div class="control">
      <input type="text" name="postcode" id="postcode" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-12 col-lg-12">
      <div class="actions-toolbar">
      <div class="primary">
      <button type="submit" class="action submit primary" id="sub_btn" title="<?php echo __('Submit') ?>">
      <span><?php echo __('Submit') ?></span></button>
      </div>
      </div>
      </div>

      </form>
      </div>
      </div>

      <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
      <script type="text/javascript">
      require([
      'jquery'
      ], function($)

      jQuery(document).ready(function()
      jQuery("#custom-form").validate(
      rules:
      first_name: "required",
      last_name: "required",
      email:
      required: true,
      email: true
      ,
      phone_no:
      required:true,
      number:true
      ,
      address1: "required",
      city: "required",
      region: "required",
      postcode: "required"
      ,
      messages:
      first_name: "Please enter your Firstname",
      last_name: "Please enter your Lastname",
      email: "Please enter a valid Email Address",
      phone_no:
      required: "Please enter your Phone Number",
      number:"Please enter numbers Only"
      ,
      address1: "Please enter your Address",
      city: "Please enter your City",
      region: "Please enter your State/Province",
      postcode: "Please enter your Zipcode"
      ,
      submitHandler: function(form)
      //event.preventDefault();
      // alert("Do some stuff...");
      form.submit();
      return false;
      //submit via ajax


      );
      );
      );
      </script>


      Any help would be appreciated.










      share|improve this question














      I have used jQuery validation, but it is not working on pressing enter key in Magento2.2.5?



      But works on Submit button.



      Refer my code.



      <?php
      ?>
      <div class="row margincontrol">
      <form class="form"
      id="custom-form"
      method="post"
      action="<?php echo $block->getBaseUrl().'warranty/index/result' ?>"
      autocomplete="off">

      <fieldset class="fieldset">
      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="first_name" class="label"><span class="font_app"><?php echo __('First Name') ?></span></label>
      <div class="control">
      <input type="text" name="first_name" id="first_name" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="last_name" class="label boxspaing"><span class="font_app"><?php echo __('Last Name') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="last_name" id="last_name" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="email" class="label"><span class="font_app"><?php echo __('Email') ?></span></label>
      <div class="control">
      <input type="text" name="email" id="email" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="phone_no" class="label boxspaing"><span class="font_app"><?php echo __('Telephone') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="phone_no" id="phone_no" maxlength ="10"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="address1" class="label"><span class="font_app"><?php echo __('Address 1') ?></span></label>
      <div class="control">
      <input type="text" name="address1" id="address1"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field address2">
      <label for="address2" class="label boxspaing"><span class="font_app"><?php echo __('Address 2') ?></span></label>
      <div class="control boxspaing">
      <input type="text" name="address2" id="address2"
      class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="city" class="label"><span class="font_app"><?php echo __('City:') ?></span></label>
      <div class="control">
      <input type="text" name="city" id="city" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-6 col-lg-6 field required">
      <label for="postcode" class="label"><span class="font_app"><?php echo __('Zipcode') ?></span></label>
      <div class="control">
      <input type="text" name="postcode" id="postcode" class="input-text" value="">
      </div>
      </div>

      <div class="col-sm-12 col-md-12 col-lg-12">
      <div class="actions-toolbar">
      <div class="primary">
      <button type="submit" class="action submit primary" id="sub_btn" title="<?php echo __('Submit') ?>">
      <span><?php echo __('Submit') ?></span></button>
      </div>
      </div>
      </div>

      </form>
      </div>
      </div>

      <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
      <script type="text/javascript">
      require([
      'jquery'
      ], function($)

      jQuery(document).ready(function()
      jQuery("#custom-form").validate(
      rules:
      first_name: "required",
      last_name: "required",
      email:
      required: true,
      email: true
      ,
      phone_no:
      required:true,
      number:true
      ,
      address1: "required",
      city: "required",
      region: "required",
      postcode: "required"
      ,
      messages:
      first_name: "Please enter your Firstname",
      last_name: "Please enter your Lastname",
      email: "Please enter a valid Email Address",
      phone_no:
      required: "Please enter your Phone Number",
      number:"Please enter numbers Only"
      ,
      address1: "Please enter your Address",
      city: "Please enter your City",
      region: "Please enter your State/Province",
      postcode: "Please enter your Zipcode"
      ,
      submitHandler: function(form)
      //event.preventDefault();
      // alert("Do some stuff...");
      form.submit();
      return false;
      //submit via ajax


      );
      );
      );
      </script>


      Any help would be appreciated.







      magento2 jquery form-validation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 mins ago









      AmyAmy

      3379




      3379




















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268464%2fjquery-validation-not-working-on-pressing-enter-key-in-magento2-2-5%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268464%2fjquery-validation-not-working-on-pressing-enter-key-in-magento2-2-5%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

          Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

          Aasi (pallopeli) Navigointivalikko