Questions tagged [form-validation]
Denotes question related to form validation. form validation contain frontend forms, adminhtml forms, UI components based forms
288
questions
0
votes
1answer
100 views
Correct way to block checkout step progress due to invalid postcode
I'm trying to switch the default shipping and billing address postcode validation, where instead of showing a warning if the postcode isn't valid for the selected country, it should show an error and ...
0
votes
0answers
29 views
Magento 2 : Disable form submit button untill required fields are not filled
I want to disable submit button untill required form fields are filled. Once the fields are filled, enable the button.
Can someone please guide me?
0
votes
0answers
24 views
Magento 2 Ajax form key invalid request
I'm trying to send a form from a modal and also an image from that form.
the form_data works fine with only serialize(), but I need to attach the image to data, so I did this:
click: function (data)...
0
votes
0answers
16 views
how can I add my custom validation logic to product edit/create form?
I would like to add some custom logic when a product is saved to validate the data in the form before it is saved in the database. In order to achieve this I decided to create an after Plugin to hook ...
0
votes
0answers
10 views
Get input context in Magento UI validation
Is it possible to get information about the element that is being validated, when using Magento_Ui/js/lib/validation/validator?
I've added a validation rule for a custom field in the checkout. In my ...
0
votes
0answers
16 views
Magento 2 Custom Form Validation Not Working
I have built a custom CMS form page in Magento 2 that sends an email with the results. The form loads correctly, and the email is generated correctly, but the form validation is not working. If the ...
0
votes
0answers
5 views
Extending Native Validation
Is there a way to extend lib/web/mage/validation/validation.js? I want to add my own logic on 'validate-grouped-qty' section. I know (I think) that you can just copy the whole file and add it to your ...
0
votes
1answer
23 views
How to check if configurable options have been chosen before showing a modal?
I have added a new button next to the add-to-cart button:
<button type="button" class="action secondary personalize" data-trigger="personalise">
<span data-...
0
votes
0answers
16 views
How to make the shipping address fields mandatory Magento 2?
Magento allows you to add up to 4 fields for the address.
I need to make the fields of the form for submission mandatory, they are 3 text fields and also modify their labels
Any ideas?
1
vote
1answer
152 views
Magento2 restrict cc number in the form fields
I would like to restrict CC number (Ex: 4111111111111111) in the customer form fields in the magento2 frontend.
Could you please advise me on how to do the step by step in Magento2.
Expected Results:
...
0
votes
0answers
13 views
Form field validation not working
It looks like I do not execute my validation.
I'm inside app/code/Cpy/Customer/view/frontend/templates/address/widget/telephone.phtml
In that template I have this field
<div class="field ...
0
votes
1answer
29 views
How to change “This is required field” message to field-wise magento 2 customer registration
If I am submitting registration form as blank then all fields are showing an error message:
This is required field
I want to change this message according to fields.
For Example:
> > First ...
1
vote
0answers
61 views
Magento 2: How to use form key parameter in GET request?
I'm using magento 2.3.4 and i tried to generate a delete cart item like this in phtml file:
<?php $formKey = $this->helper('Vendore\Module\Helper\Data')->getFormKey() ?>
<a ...
1
vote
1answer
63 views
Magento 2 onepage checkout validation issue
I'm using IWD onepage checkout module. Everything working fine. I also integrated porto magento 2 theme with it. When I try to checkout I get state as required field even though if I selected it. I ...
0
votes
0answers
11 views
Magento 1.9 - How do I get default captcha in custom template file?
I had created a custom template file for a custom newsletter subscription form for my Magento 1.9 store, How do I get magento default captcha in that form?
Is there any way to call default captcha in ...
0
votes
0answers
12 views
How to add Magento Default Captcha to all forms
I want to add the Magento Default Captcha to all forms of my magento 1.9 store. I want to add the default captch on forms like Contact Form, Review Form, Register Form, Onepage Checkout, Customer ...
0
votes
1answer
22 views
How to add a green border if validation is completed when submitting the form
Magento 2 has basic validation if the field is not valid.
How to add custom validation to the checkout page which will add a green border and an inscription that notifies the user of a successful ...
1
vote
0answers
42 views
How to add icons to input fields if the field has not passed validation
I need to add a custom icon to the floor if the field does not pass validation, as in the screenshot.
I tried to implement this functionality with ':after' in CSS
&._error .control input {
...
0
votes
0answers
27 views
Server-side validation after form submit for register page in Magento 2.3
How to use \Magento\Eav\Model\Attribute\Data\Text::validateLength to add validate.
currently, I'm using the code below to validate
<type name="Magento\Customer\Controller\Account\CreatePost">
...
1
vote
0answers
38 views
Magento 2 custom form in shipping address before-form not validating for registered customers
I have added a custom form in the shipping address before-form handle. This form is validating for a guest checkout process but not working for logged in customers who have already added address ...
0
votes
1answer
152 views
Magento2 - Form validate instant and add class
Is there a way to directly validate a form in Magento2.3x?
So that when the input focus goes to the next input element, it automatically validates the previous input and add a class to the input?
We ...
0
votes
1answer
59 views
Magento 2 how to override Magento\Directory\Block\Data using preferences?
This is my code but the block is not overrided
My di file :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
0
votes
0answers
22 views
Magento 1.9 - Remove leading/trailing spaces from address fields
We have the problem that leading and trailing spaces in the address fields in the onepage checkout are causing problems when printing the shipping labels.
The fields postcode and city don't seem to be ...
0
votes
2answers
61 views
how to add magento2 checkout shipping form add validate-digits-range
I am trying to override checkout_index_index.xml using below code for minimum digits :
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<...
0
votes
1answer
141 views
Magento 2 : How to remove _required class for region and region_id in shipping address?
I have updated Magento 2.3.3 after that I'm getting the error in region and region_id on the checkout page. So I need to remove the _required class in the checkout shipping form.
Please refer ...
0
votes
1answer
251 views
Magento 2 - How to change the error placement in a custom form on checkout page
I wish to place the error after the parent of the element being validated.
I tried to change the place via error placement function like below
<script>
require([
"jquery",
"...
0
votes
0answers
21 views
Edit checkout shipment form
After upgrade magento version 2.3.1 to 2.3.3, i face an error in checkout shipment form, there is "county and country" text field. So i need to hide "county" field in checkout shipment form. Is it ...
1
vote
1answer
363 views
Error message for email and confirm email validation
I have 2 fields in form .
1.user email
2.confirm email.
If I fill on user email field and moved to confirm email field then enter wrong email i.e; not same as user email, it is showing error "both ...
1
vote
0answers
85 views
Spambot protection fake customer registration
I want to reject all the registration of fake customers with a specific domain email.
Since the spambot can send the data through POST it does not enough create a new data-validate rule in the ...
0
votes
1answer
36 views
Magento2: How to customize the Billing address form?
Currently there is no validation class available in phone number field.
I want to add "validate-digits" class, but I am not able to find the related file, Please help me how to do this changes so ...
0
votes
2answers
166 views
Make taxvat not required on customer registration form programmatically
I want to force taxvat field as not required on customer create form
Even if i have ovrride
vendor/magento/module-customer/view/frontend/templates/widget/taxvat.phtml
with a plugin in my custom ...
1
vote
0answers
13 views
Ignore some field from VarienForm validate
I have a form, and it is validated by:
var productAddToCartForm = new VarienForm('product_addtocart_form');
So is there any way for removing some field we want from VarienForm validate? Thank for ...
0
votes
1answer
106 views
Magento 2 How to validate new Billing address form in checkout page
Here in new Billing address form in checkout page I have fields of Zip/Postal Code, and Phone number. I added Validation for those two working fine. But its getting saved if they are Empty. How to ...
1
vote
1answer
72 views
Magento 2 - Customer name validation
On the checkout shipping section the first and last name input fields have validation on them which doesn't accept hyphens (-) or ' characters
I had a look in lib/mage/validation.js but can't see ...
0
votes
1answer
738 views
Magento2: How to change the Shipping Address Form validation message?
I want to change the shipping address form validation message(Just want to replace : 'This field required' to 'Enter FirstName') in magento2
I want to change the below validation message text how can ...
0
votes
1answer
38 views
All form submitted without trigger js validation on first time load with browser empty cache
I am facing some weird problem on my site.
When i try to reload with empty cache then all the form submitted without triggering js validation.
https://prnt.sc/ov6tk0
after first submit it start ...
2
votes
1answer
90 views
Billing form is not updating in magento 2
I am trying to updating the checkout forms telephone field validation. I have achieved this for shipping form but in billing form it is not working.
For this I have done in my di.xml:
<type name=...
1
vote
0answers
924 views
Magento2.3.1: Date of birth validation issue on customer registration page
On Magento 2 Account registration page, When I create account and enter date of birth then it shows error that Please enter a valid date.
I am selecting date with magento default date picker
How do ...
0
votes
2answers
159 views
Magento 2 How to disable Postal/Zip code validation from admin while edit customer?
I am facing a strange issue while adding Customer, I had filled all the fields in the customer form including Zipcode but still, I am getting error
"Zip/Postal Code" is a required value.
In my ...
3
votes
1answer
1k views
Magento 2: How To Disable Button On Form Submit?
I'm trying to disable button after submitting form, but i'm facing some issue, when i submit black field it validate the form and disable the button... but i want to disable it on form submit ...
0
votes
1answer
85 views
Configurable product validation doesn't work correct
When I click add cart it show second option. I think it should show first option.
Now it show:
I think it should show like this
Any help would be greatly appreciated!
0
votes
1answer
452 views
Magento2: TypeError: $.validator.methods[method] is undefined
I am getting the below error after applying the validation in my form:
Magento2: TypeError: $.validator.methods[method] is undefined
Here is my validation code:
I have extended the customer ...
1
vote
1answer
2k views
Magento 2 - Do not scroll to invalid field on form validation
On the log in page, when I don't input input in fields, the error message displays focusing on the invalid input. The window scrolls upto the invalid field at the same time.
I do not want the window ...
1
vote
0answers
95 views
Magento form validation doesn't work as user type in
I have added form validation for the customer address form.
but the issue is, validation works when I click submit button, it should work as user types in(key-up).
city text box
<input type="...
2
votes
1answer
1k views
TypeError: t.validator.methods[a] is undefined issue in jquery validation in magento2
I am facing this issue TypeError: t.validator.methods[a] is undefined after adding jquery validation in my form.
Here is my validation code:
<script src="http://ajax.aspnetcdn.com/ajax/jquery....
0
votes
1answer
338 views
How to remove default validation from login and registration form in magento2.2.5?
I want to remove default validation from login and registration form and add my custom validation in magento2.2.5?
1
vote
0answers
10 views
How to add required validation on a particular filed in customer add form using JS?
I have created a custom field in customer add form using ui component. I want to add required validation to that filed using JS.
Please help. Thanks in advance.
0
votes
0answers
44 views
Magento 2 required attribute in custom payment option not working
I have a custom payment module with select options.
I try to add 'required' to the option but it failed.
I add 'data-mage-init' in tag and data-validate attribute in tag.
Should I add anything on ...
2
votes
1answer
544 views
only alphabet in firstname and lastname in customer registration form Magento 2
How can i add validations for only alphabets in First name and Last name fields in Customer registration form?
0
votes
1answer
139 views
Overriding the contact form module gets the fatal error in Magento2.2.5?
I have overriden the contact form module, after disabling the default contact form validation and apply my custom validation gets the following error:
Fatal error: Uncaught TypeError: Argument 1 ...