Magento custom option text field max length












0















Previously when it was specified, Magento used to honor the max character length for custom input fields, so if I set that to two characters (for initials), it would not let the customer type in more than two characters.



Now I see that even though the note underneath the text field still says maximum two characters allowed, I can type in as many characters as I want. Anyone know how to troubleshoot such problem, I checked my browsers console and see no JavaScript errors being thrown there, any help is welcome.



Thanks in advance!










share|improve this question
















bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    Previously when it was specified, Magento used to honor the max character length for custom input fields, so if I set that to two characters (for initials), it would not let the customer type in more than two characters.



    Now I see that even though the note underneath the text field still says maximum two characters allowed, I can type in as many characters as I want. Anyone know how to troubleshoot such problem, I checked my browsers console and see no JavaScript errors being thrown there, any help is welcome.



    Thanks in advance!










    share|improve this question
















    bumped to the homepage by Community 10 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      Previously when it was specified, Magento used to honor the max character length for custom input fields, so if I set that to two characters (for initials), it would not let the customer type in more than two characters.



      Now I see that even though the note underneath the text field still says maximum two characters allowed, I can type in as many characters as I want. Anyone know how to troubleshoot such problem, I checked my browsers console and see no JavaScript errors being thrown there, any help is welcome.



      Thanks in advance!










      share|improve this question
















      Previously when it was specified, Magento used to honor the max character length for custom input fields, so if I set that to two characters (for initials), it would not let the customer type in more than two characters.



      Now I see that even though the note underneath the text field still says maximum two characters allowed, I can type in as many characters as I want. Anyone know how to troubleshoot such problem, I checked my browsers console and see no JavaScript errors being thrown there, any help is welcome.



      Thanks in advance!







      magento-1.9






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 '17 at 12:08







      K.I

















      asked Mar 23 '17 at 14:42









      K.IK.I

      188111




      188111





      bumped to the homepage by Community 10 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 10 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Default magento not provide character limit while typing in custom option text box so we can use jquey using below code




          $(document).ready(function()
          {
          $(".product-options input").attr('maxlength','3');
          });




          you need set character limit. Replace 3 with your character limit number.



          i hope it will be helpful for you !!






          share|improve this answer
























          • Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

            – K.I
            Mar 28 '17 at 9:07











          • Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

            – Mukesh Prajapati
            Mar 28 '17 at 11:23











          • I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

            – K.I
            Apr 4 '17 at 16:53











          • This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

            – Mukesh Prajapati
            Apr 5 '17 at 6:43











          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%2f165866%2fmagento-custom-option-text-field-max-length%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














          Default magento not provide character limit while typing in custom option text box so we can use jquey using below code




          $(document).ready(function()
          {
          $(".product-options input").attr('maxlength','3');
          });




          you need set character limit. Replace 3 with your character limit number.



          i hope it will be helpful for you !!






          share|improve this answer
























          • Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

            – K.I
            Mar 28 '17 at 9:07











          • Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

            – Mukesh Prajapati
            Mar 28 '17 at 11:23











          • I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

            – K.I
            Apr 4 '17 at 16:53











          • This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

            – Mukesh Prajapati
            Apr 5 '17 at 6:43
















          0














          Default magento not provide character limit while typing in custom option text box so we can use jquey using below code




          $(document).ready(function()
          {
          $(".product-options input").attr('maxlength','3');
          });




          you need set character limit. Replace 3 with your character limit number.



          i hope it will be helpful for you !!






          share|improve this answer
























          • Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

            – K.I
            Mar 28 '17 at 9:07











          • Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

            – Mukesh Prajapati
            Mar 28 '17 at 11:23











          • I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

            – K.I
            Apr 4 '17 at 16:53











          • This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

            – Mukesh Prajapati
            Apr 5 '17 at 6:43














          0












          0








          0







          Default magento not provide character limit while typing in custom option text box so we can use jquey using below code




          $(document).ready(function()
          {
          $(".product-options input").attr('maxlength','3');
          });




          you need set character limit. Replace 3 with your character limit number.



          i hope it will be helpful for you !!






          share|improve this answer













          Default magento not provide character limit while typing in custom option text box so we can use jquey using below code




          $(document).ready(function()
          {
          $(".product-options input").attr('maxlength','3');
          });




          you need set character limit. Replace 3 with your character limit number.



          i hope it will be helpful for you !!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 '17 at 14:11









          Mukesh PrajapatiMukesh Prajapati

          1,146415




          1,146415













          • Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

            – K.I
            Mar 28 '17 at 9:07











          • Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

            – Mukesh Prajapati
            Mar 28 '17 at 11:23











          • I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

            – K.I
            Apr 4 '17 at 16:53











          • This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

            – Mukesh Prajapati
            Apr 5 '17 at 6:43



















          • Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

            – K.I
            Mar 28 '17 at 9:07











          • Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

            – Mukesh Prajapati
            Mar 28 '17 at 11:23











          • I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

            – K.I
            Apr 4 '17 at 16:53











          • This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

            – Mukesh Prajapati
            Apr 5 '17 at 6:43

















          Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

          – K.I
          Mar 28 '17 at 9:07





          Hi, thank you for the answer, but that will not work for us because we have more than one textfield and only one needs to have a size restriction.

          – K.I
          Mar 28 '17 at 9:07













          Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

          – Mukesh Prajapati
          Mar 28 '17 at 11:23





          Ok then you can use input position if its first then use input:first-child if other then use input:nth-child(n) if its last then use input:last-child . Just replace input with input and its position.

          – Mukesh Prajapati
          Mar 28 '17 at 11:23













          I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

          – K.I
          Apr 4 '17 at 16:53





          I had to make some changes to this suggestion to make it work, because when I used input:first-child or :nth-child it was setting restrictions either to all textfields or not setting them at all. I used input:eq(n) instead and that let me select second value and only add character restrictions on that variable.

          – K.I
          Apr 4 '17 at 16:53













          This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

          – Mukesh Prajapati
          Apr 5 '17 at 6:43





          This is your answer jQuery( document ).ready(function() { jQuery(".input-box input:eq(1)").attr('maxlength','3') }); its working for second input box @K.I

          – Mukesh Prajapati
          Apr 5 '17 at 6:43


















          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%2f165866%2fmagento-custom-option-text-field-max-length%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

          Polycentropodidae

          Magento 2 Error message: Invalid state change requested

          Paulmy