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;
How can i add validations for only alphabets in First name and Last name fields in Customer registration form?
magento2 form-validation customer-registration
add a comment |
How can i add validations for only alphabets in First name and Last name fields in Customer registration form?
magento2 form-validation customer-registration
add a comment |
How can i add validations for only alphabets in First name and Last name fields in Customer registration form?
magento2 form-validation customer-registration
How can i add validations for only alphabets in First name and Last name fields in Customer registration form?
magento2 form-validation customer-registration
magento2 form-validation customer-registration
edited 2 days ago
Rakesh Donga
2,679317
2,679317
asked 2 days ago
KhushbuKhushbu
11212
11212
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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