only alphabet in firstname and lastname in customer registration form Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Customer Login, Registration, Forgot password on single pageHow can I change validation for registration formMagento 2 - Remove last name from registration formHow to post customer firstname & lastname into database magento 2.1.1?Magento 2. Duplicate firstname, lastname, email inputs on customer account create frontendMagento 2 how to add extra validation to new Billing address form fields in checkout pageLimit customer firstname and lastname in m2Shipping address, add new address form validation in checkout pageChange Firstname, Lastname label in customer registration in Magento2.1.7?Magento 2: add Validation on first name and last name so it only accept text value, not numeric

How can I list files in reverse time order by a command and pass them as arguments to another command?

First paper to introduce the "principal-agent problem"

Can gravitational waves pass through a black hole?

Why can't fire hurt Daenerys but it did to Jon Snow in season 1?

How to make triangles with rounded sides and corners? (squircle with 3 sides)

How do I find my Spellcasting Ability for my D&D character?

What was the last profitable war?

Baking rewards as operations

Short story about astronauts fertilizing soil with their own bodies

Besides transaction validation, are there any other uses of the Script language in Bitcoin

Marquee sign letters

Is there a verb for listening stealthily?

How to name indistinguishable henchmen in a screenplay?

What is "Lambda" in Heston's original paper on stochastic volatility models?

Flight departed from the gate 5 min before scheduled departure time. Refund options

Why is there so little support for joining EFTA in the British parliament?

Is this Kuo-toa homebrew race balanced?

Does the universe have a fixed centre of mass?

As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Twin's vs. Twins'

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Getting representations of the Lie group out of representations of its Lie algebra

How to resize main filesystem



only alphabet in firstname and lastname in customer registration form Magento 2



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Customer Login, Registration, Forgot password on single pageHow can I change validation for registration formMagento 2 - Remove last name from registration formHow to post customer firstname & lastname into database magento 2.1.1?Magento 2. Duplicate firstname, lastname, email inputs on customer account create frontendMagento 2 how to add extra validation to new Billing address form fields in checkout pageLimit customer firstname and lastname in m2Shipping address, add new address form validation in checkout pageChange Firstname, Lastname label in customer registration in Magento2.1.7?Magento 2: add Validation on first name and last name so it only accept text value, not numeric



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








2















How can i add validations for only alphabets in First name and Last name fields in Customer registration form?










share|improve this question






























    2















    How can i add validations for only alphabets in First name and Last name fields in Customer registration form?










    share|improve this question


























      2












      2








      2








      How can i add validations for only alphabets in First name and Last name fields in Customer registration form?










      share|improve this question
















      How can i add validations for only alphabets in First name and Last name fields in Customer registration form?







      magento2 form-validation customer-registration






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Rakesh Donga

      2,679317




      2,679317










      asked 2 days ago









      KhushbuKhushbu

      11212




      11212




















          1 Answer
          1






          active

          oldest

          votes


















          1














          Extend name.phtml file in your theme as below and add letters-only validation:-



          appdesignfrontendVendorNamethemenameMagento_Customertemplateswidgetname.phtml


          First Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getFirstname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('firstname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" <?php if ($block->getAttributeValidationClass('firstname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Last Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getLastname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('lastname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" <?php if ($block->getAttributeValidationClass('lastname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Now letters-only validation only accept letter in first name and last name, not numeric value.






          share|improve this answer

























          • It's working! Thanks.

            – Khushbu
            2 days ago






          • 2





            This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

            – Marius
            2 days ago











          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%2f270737%2fonly-alphabet-in-firstname-and-lastname-in-customer-registration-form-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









          1














          Extend name.phtml file in your theme as below and add letters-only validation:-



          appdesignfrontendVendorNamethemenameMagento_Customertemplateswidgetname.phtml


          First Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getFirstname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('firstname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" <?php if ($block->getAttributeValidationClass('firstname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Last Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getLastname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('lastname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" <?php if ($block->getAttributeValidationClass('lastname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Now letters-only validation only accept letter in first name and last name, not numeric value.






          share|improve this answer

























          • It's working! Thanks.

            – Khushbu
            2 days ago






          • 2





            This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

            – Marius
            2 days ago















          1














          Extend name.phtml file in your theme as below and add letters-only validation:-



          appdesignfrontendVendorNamethemenameMagento_Customertemplateswidgetname.phtml


          First Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getFirstname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('firstname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" <?php if ($block->getAttributeValidationClass('firstname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Last Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getLastname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('lastname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" <?php if ($block->getAttributeValidationClass('lastname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Now letters-only validation only accept letter in first name and last name, not numeric value.






          share|improve this answer

























          • It's working! Thanks.

            – Khushbu
            2 days ago






          • 2





            This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

            – Marius
            2 days ago













          1












          1








          1







          Extend name.phtml file in your theme as below and add letters-only validation:-



          appdesignfrontendVendorNamethemenameMagento_Customertemplateswidgetname.phtml


          First Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getFirstname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('firstname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" <?php if ($block->getAttributeValidationClass('firstname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Last Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getLastname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('lastname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" <?php if ($block->getAttributeValidationClass('lastname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Now letters-only validation only accept letter in first name and last name, not numeric value.






          share|improve this answer















          Extend name.phtml file in your theme as below and add letters-only validation:-



          appdesignfrontendVendorNamethemenameMagento_Customertemplateswidgetname.phtml


          First Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getFirstname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('firstname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('firstname')) ?>" <?php if ($block->getAttributeValidationClass('firstname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Last Name:-



          <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"
          name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>"
          value="<?= $block->escapeHtmlAttr($block->getObject()->getLastname()) ?>"
          title="<?= $block->escapeHtmlAttr($block->getStoreLabel('lastname')) ?>"
          class="letters-only input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass('lastname')) ?>" <?php if ($block->getAttributeValidationClass('lastname') == 'required-entry') echo ' data-validate="required:true"' ?>>


          Now letters-only validation only accept letter in first name and last name, not numeric value.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered 2 days ago









          Rakesh DongaRakesh Donga

          2,679317




          2,679317












          • It's working! Thanks.

            – Khushbu
            2 days ago






          • 2





            This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

            – Marius
            2 days ago

















          • It's working! Thanks.

            – Khushbu
            2 days ago






          • 2





            This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

            – Marius
            2 days ago
















          It's working! Thanks.

          – Khushbu
          2 days ago





          It's working! Thanks.

          – Khushbu
          2 days ago




          2




          2





          This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

          – Marius
          2 days ago





          This is a nice an simple way to do a client side validation, but if the user really wants to, he/she can bypass this client side validation and actually fill in whatever for the firstname and lastname. You need a server side validation also. Unfortunately, I don't know exactly where the customer data validation happens. I just wanted to point this up as it might help have this in mind

          – Marius
          2 days ago

















          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%2f270737%2fonly-alphabet-in-firstname-and-lastname-in-customer-registration-form-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

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

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?