Make required field to Gift Option in Magento 2Make zip/postal code field required in 'Estimate Shipping and Tax' section - Shopping Cart pageHow to make the address field “company” required?Create Account not working properly for Guest User : Delete operation is forbidden for current area (Enterprise Magento ver. 2.1.0)Magento 2: Initialize calendar widget inside payment uiComponentMagento 2 Add new field to Magento_User admin formValidate Ui ComponentRequired field error in Billing InformationHow to make optional fieldMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?How to make a field required on product edit page only if another filed is checked

Importance of moon phases for Apollo missions

What does a Nintendo Game Boy do when turned on without a game cartridge inserted?

How to handle not being able to attend as often as I'd like

Magic is the twist

Piece of fabric in planter, how to use it?

Calculating Fibonacci sequence in several different ways

Finding Greatest Common Divisor using LuaLatex

Quickest way to move a line in a text file before another line in a text file?

Found old paper shares of Motorola Inc that has since been broken up

Can the caster of Time Stop still use their bonus action or reaction?

Can a creature sustain itself by eating its own severed body parts?

Is it better to deliver many low-value stories or few high-value stories?

"It is what it is"

Are there foods that astronauts are explicitly never allowed to eat?

Reset Column Header Index

Why did modems have speakers?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

What kind of vegetable has pink and white concentric rings?

Trivial non-dark twist in dark fantasy

Meaning of 行かしてもらうから

Why Lie algebras if what we care about in physics are groups?

What should I watch before playing Alien: Isolation?

Pass USB 3.0 connection through D-SUB connector

Why is there an extra "t" in Lemmatization?



Make required field to Gift Option in Magento 2


Make zip/postal code field required in 'Estimate Shipping and Tax' section - Shopping Cart pageHow to make the address field “company” required?Create Account not working properly for Guest User : Delete operation is forbidden for current area (Enterprise Magento ver. 2.1.0)Magento 2: Initialize calendar widget inside payment uiComponentMagento 2 Add new field to Magento_User admin formValidate Ui ComponentRequired field error in Billing InformationHow to make optional fieldMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?How to make a field required on product edit page only if another filed is checked






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I enable gift option from magento 2 admin. Now i want to make required. field on cart page.



I found that template is coming from vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html



I know how we override html files but don't know how we make require filed in html form of magento 2.



<div class="field field-from">
<label for="gift-message-whole-from" class="label">
<span data-bind="i18n: 'From:'"></span>
</label>
<div class="control">
<input type="text"
id="gift-message-whole-from"
class="input-text"
data-bind="value: getObservable('sender')">
</div>
</div>


I used this but not luck



method #1 – by setting data-validate attribute on the input field:



<input data-validate='"required":true'name="field1" id="field1" ... />


method #2 – by setting the rule names as attributes:



<input required="true" name="field2" id="field2" ... />


method #3 – by setting the rule names as classnames:



<input class="input-text required" name="field3" id="field3" ... />









share|improve this question






























    2















    I enable gift option from magento 2 admin. Now i want to make required. field on cart page.



    I found that template is coming from vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html



    I know how we override html files but don't know how we make require filed in html form of magento 2.



    <div class="field field-from">
    <label for="gift-message-whole-from" class="label">
    <span data-bind="i18n: 'From:'"></span>
    </label>
    <div class="control">
    <input type="text"
    id="gift-message-whole-from"
    class="input-text"
    data-bind="value: getObservable('sender')">
    </div>
    </div>


    I used this but not luck



    method #1 – by setting data-validate attribute on the input field:



    <input data-validate='"required":true'name="field1" id="field1" ... />


    method #2 – by setting the rule names as attributes:



    <input required="true" name="field2" id="field2" ... />


    method #3 – by setting the rule names as classnames:



    <input class="input-text required" name="field3" id="field3" ... />









    share|improve this question


























      2












      2








      2








      I enable gift option from magento 2 admin. Now i want to make required. field on cart page.



      I found that template is coming from vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html



      I know how we override html files but don't know how we make require filed in html form of magento 2.



      <div class="field field-from">
      <label for="gift-message-whole-from" class="label">
      <span data-bind="i18n: 'From:'"></span>
      </label>
      <div class="control">
      <input type="text"
      id="gift-message-whole-from"
      class="input-text"
      data-bind="value: getObservable('sender')">
      </div>
      </div>


      I used this but not luck



      method #1 – by setting data-validate attribute on the input field:



      <input data-validate='"required":true'name="field1" id="field1" ... />


      method #2 – by setting the rule names as attributes:



      <input required="true" name="field2" id="field2" ... />


      method #3 – by setting the rule names as classnames:



      <input class="input-text required" name="field3" id="field3" ... />









      share|improve this question
















      I enable gift option from magento 2 admin. Now i want to make required. field on cart page.



      I found that template is coming from vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html



      I know how we override html files but don't know how we make require filed in html form of magento 2.



      <div class="field field-from">
      <label for="gift-message-whole-from" class="label">
      <span data-bind="i18n: 'From:'"></span>
      </label>
      <div class="control">
      <input type="text"
      id="gift-message-whole-from"
      class="input-text"
      data-bind="value: getObservable('sender')">
      </div>
      </div>


      I used this but not luck



      method #1 – by setting data-validate attribute on the input field:



      <input data-validate='"required":true'name="field1" id="field1" ... />


      method #2 – by setting the rule names as attributes:



      <input required="true" name="field2" id="field2" ... />


      method #3 – by setting the rule names as classnames:



      <input class="input-text required" name="field3" id="field3" ... />






      magento2 forms fieldsets required






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 16 '17 at 9:53







      Rahul

















      asked Aug 12 '17 at 6:01









      RahulRahul

      2494 silver badges22 bronze badges




      2494 silver badges22 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Override this template and add required="true" inside <input>. So that in your case:



          <div class="field field-from">
          <label for="gift-message-whole-from" class="label">
          <span data-bind="i18n: 'From:'"></span>
          </label>
          <div class="control">
          <input type="text"
          id="gift-message-whole-from"
          class="input-text"
          data-bind="value: getObservable('sender')"
          required="true">
          </div>
          </div>


          Step 1 is not required in your case as the validation is loaded within the form already when the website run vendor/magento/module-gift-message/view/frontend/templates/inline.phtml



          Ref: http://inchoo.net/magento-2/validate-custom-form-in-magento-2/






          share|improve this answer























          • Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

            – Rahul
            Aug 16 '17 at 9:46











          • vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

            – Rahul
            Aug 16 '17 at 9:51













          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%2f188928%2fmake-required-field-to-gift-option-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Override this template and add required="true" inside <input>. So that in your case:



          <div class="field field-from">
          <label for="gift-message-whole-from" class="label">
          <span data-bind="i18n: 'From:'"></span>
          </label>
          <div class="control">
          <input type="text"
          id="gift-message-whole-from"
          class="input-text"
          data-bind="value: getObservable('sender')"
          required="true">
          </div>
          </div>


          Step 1 is not required in your case as the validation is loaded within the form already when the website run vendor/magento/module-gift-message/view/frontend/templates/inline.phtml



          Ref: http://inchoo.net/magento-2/validate-custom-form-in-magento-2/






          share|improve this answer























          • Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

            – Rahul
            Aug 16 '17 at 9:46











          • vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

            – Rahul
            Aug 16 '17 at 9:51















          0














          Override this template and add required="true" inside <input>. So that in your case:



          <div class="field field-from">
          <label for="gift-message-whole-from" class="label">
          <span data-bind="i18n: 'From:'"></span>
          </label>
          <div class="control">
          <input type="text"
          id="gift-message-whole-from"
          class="input-text"
          data-bind="value: getObservable('sender')"
          required="true">
          </div>
          </div>


          Step 1 is not required in your case as the validation is loaded within the form already when the website run vendor/magento/module-gift-message/view/frontend/templates/inline.phtml



          Ref: http://inchoo.net/magento-2/validate-custom-form-in-magento-2/






          share|improve this answer























          • Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

            – Rahul
            Aug 16 '17 at 9:46











          • vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

            – Rahul
            Aug 16 '17 at 9:51













          0












          0








          0







          Override this template and add required="true" inside <input>. So that in your case:



          <div class="field field-from">
          <label for="gift-message-whole-from" class="label">
          <span data-bind="i18n: 'From:'"></span>
          </label>
          <div class="control">
          <input type="text"
          id="gift-message-whole-from"
          class="input-text"
          data-bind="value: getObservable('sender')"
          required="true">
          </div>
          </div>


          Step 1 is not required in your case as the validation is loaded within the form already when the website run vendor/magento/module-gift-message/view/frontend/templates/inline.phtml



          Ref: http://inchoo.net/magento-2/validate-custom-form-in-magento-2/






          share|improve this answer













          Override this template and add required="true" inside <input>. So that in your case:



          <div class="field field-from">
          <label for="gift-message-whole-from" class="label">
          <span data-bind="i18n: 'From:'"></span>
          </label>
          <div class="control">
          <input type="text"
          id="gift-message-whole-from"
          class="input-text"
          data-bind="value: getObservable('sender')"
          required="true">
          </div>
          </div>


          Step 1 is not required in your case as the validation is loaded within the form already when the website run vendor/magento/module-gift-message/view/frontend/templates/inline.phtml



          Ref: http://inchoo.net/magento-2/validate-custom-form-in-magento-2/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 14 '17 at 7:53









          PY YickPY Yick

          1,9138 silver badges21 bronze badges




          1,9138 silver badges21 bronze badges












          • Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

            – Rahul
            Aug 16 '17 at 9:46











          • vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

            – Rahul
            Aug 16 '17 at 9:51

















          • Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

            – Rahul
            Aug 16 '17 at 9:46











          • vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

            – Rahul
            Aug 16 '17 at 9:51
















          Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

          – Rahul
          Aug 16 '17 at 9:46





          Thanks for your answer. I already used all 4 methods which is defind in inchoo. but still it's not validate text. I think gift option has not validation() passed becuse it has not <form>. any idea about this?

          – Rahul
          Aug 16 '17 at 9:46













          vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

          – Rahul
          Aug 16 '17 at 9:51





          vendor/magento/module-gift-message/view/frontend/templates/inline.phtml this file are rendering in checkout not in cart page. I worked on cart. which has gift option html which is coming from /var/www/html/georgetteklinger/vendor/magento/module-gift-message/view/frontend/web/template/gift-message-form.html and which has not <form> and passed any validation.

          – Rahul
          Aug 16 '17 at 9:51

















          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%2f188928%2fmake-required-field-to-gift-option-in-magento-2%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form