Questions tagged [form-validation]

Denotes question related to form validation. form validation contain frontend forms, adminhtml forms, UI components based forms

Filter by
Sorted by
Tagged with
0 votes
1 answer
47 views

Telephone validate number but allow international + sign

In our checkout_index_index.xml file we use the following code. This works well to validate if the input is a number, but it does not allow the international sign + followed by the country code. How ...
JGeer's user avatar
  • 1,416
1 vote
2 answers
95 views

How to set a date field in a ui form to be mandatory?

I have this date field in a form (a ui component) and i'm tryig to make it "required field", I tried with <item name="required-entry" xsi:type="boolean">true</...
elunicotomas's user avatar
2 votes
1 answer
80 views

Not able to apply validation on my custom checkout step

I am trying to apply validation on my custom checkout step field but not able to do it..i want to use magento by default validations ..below is the code attached.. my-step-view.js define([ 'ko', ...
MihirBangia's user avatar
0 votes
1 answer
42 views

Magento 2 validation problem (validate just the first field)

Simplify tthe code especially. Probem: only the first elemts will be validated on submit field-2 will be validated if I'll remove first field. Strange problem. Not depends of M2 vesion. That's phtml ...
Max.A's user avatar
  • 107
0 votes
1 answer
463 views

Magento 2: What controls the validation of the shipping form? How can I add a callback to run when the validation is successful?

I have a custom checkout module and as part of the design I need to run some custom JS when the shipping address form is valid. By default the form is validated when all the fields have values. I have ...
Steven Hall's user avatar
0 votes
1 answer
28 views

Magento 2 - Invalid Form Key for new storeview

I created a new storeview and noticed that I can't log in as a customer. It works on the main store view perfectly fine. There are no errors in the server and magento logfiles. I always get: "...
Black's user avatar
  • 3,280
1 vote
1 answer
86 views

Custom Customer Address field not passing validation

I've added a custom field to the Customer Addresses with the following UpgradeData: public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var ...
dotancohen's user avatar
  • 1,115
1 vote
0 answers
92 views

How i put extra validation in order form in admin area using js

I am new in magento development. please suggest me how to create js validation module in magento 2 how to link form with order from in admin area. Validation form is below:
Alok Tiwari's user avatar
2 votes
2 answers
565 views

Magento2: Custom validation in checkout address form

I'm trying to add a custom validation to some input fields in checkout address forms. The official guide works fine on addressbook and other forms, extending mage/validator and using addMethod is ...
kionez's user avatar
  • 31
0 votes
1 answer
525 views

How to add Multiple validation rule

I have to add three validation rule and as you see below code works well for one rule : validation-mixin.js define([ 'jquery' ], function ($) { "use strict"; console.log('this is ...
Peren's user avatar
  • 27
1 vote
0 answers
44 views

Validation Name is not working

Actually, I add validation of alpha-num there it shows the Magento default validation message there. I want to add my custom message there. Validation is working app/design/frontend/Theme/CustomTheme/...
Rana Zain's user avatar
  • 642
0 votes
1 answer
357 views

Magento 2 - Make fields in custom form required

I created a custom controller and model where users can save bank payment data information. I added a form where users can change data from the model. Is there a way to reuse the magento code to ...
Black's user avatar
  • 3,280
0 votes
1 answer
35 views

File upload form with file resolution check/validation

Our products come with an optional personalised printing service. Customers can choose to print a logo on a shirt. Therefore we need a form with a logo upload function. Which Requires file extension ...
MoCommerce's user avatar
0 votes
1 answer
951 views

Same min and max length character validation for UI Component form field

I have created a form using UI components. I am able to add min and max length field validation using the below code. <field name="sku"> <argument name="data" ...
amitshree's user avatar
  • 6,966
0 votes
0 answers
95 views

Magento 2 : Disallow Specific Phone Number

We would like to disallow some specific phone numbers, especially in the checkout. For example the phone number: 0000000000 or 1111111111. How can we disallow these phone numbers?
JGeer's user avatar
  • 1,416
0 votes
2 answers
307 views

Ajax Add to Cart validation - When customer add more products to cart than the stock quantity is available in Product

When user is adding/increasing quantity than how to we can restrict him ? He can't add/increase quantity more than available saleable quantity. How to we can apply validation for display error message ...
Wajahat Bashir's user avatar
0 votes
1 answer
1k views

Magento2 make one field required

I have a custom form created in Magento2 which has 4 different types of <input type=" text"> fields, I want to make sure the user enters at least one of those input field(s) and that ...
Zeeshan Khuwaja's user avatar
1 vote
0 answers
208 views

date range validation in magento 2 ui comonent

I have created a custom module to mark order as delivered , In my ui component file located at app/code/Namespace/Modulename/view/adminhtml/ui_component/namespace_delivery_form.xml i have the ...
Ritesh Kumar's user avatar
0 votes
2 answers
334 views

How to toggle “required/not required” custom customer attribute field?

Whether the field is invisible/optional/required in the forms should be configurable from the admin side and enforced both client and server side.
David Tabatadze's user avatar
0 votes
1 answer
317 views

Magento 2 - Removed Required From Last name on Checkout Page?

How to remove last name required validation from checkout page ?
Wakar Ahamad's user avatar
0 votes
2 answers
451 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 ...
bsod99's user avatar
  • 165
0 votes
0 answers
438 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?
Sejal Shah's user avatar
  • 2,141
0 votes
1 answer
380 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)...
Oscar Vazquez's user avatar
2 votes
0 answers
244 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 ...
gabtzi's user avatar
  • 656
0 votes
0 answers
535 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 ...
user2452745's user avatar
0 votes
1 answer
395 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-...
Richard Parnaby-King's user avatar
1 vote
1 answer
610 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: ...
Nagaraju Kasa's user avatar
0 votes
1 answer
1k 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 ...
Vinod Kumar's user avatar
  • 2,045
1 vote
1 answer
795 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 ...
jojo's user avatar
  • 179
1 vote
1 answer
147 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 ...
Ramesh KR's user avatar
  • 866
0 votes
0 answers
35 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 ...
IntraPersonalLearner's user avatar
0 votes
1 answer
135 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 ...
ann karsksya's user avatar
1 vote
0 answers
188 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 { ...
ann karsksya's user avatar
2 votes
1 answer
506 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 ...
Radhu's user avatar
  • 169
0 votes
2 answers
1k 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 ...
JGeer's user avatar
  • 1,416
0 votes
1 answer
319 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:...
Parween Talat's user avatar
0 votes
2 answers
299 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"> <...
kinjal mehta's user avatar
0 votes
1 answer
1k 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 ...
Priya's user avatar
  • 589
0 votes
1 answer
1k 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", "...
Sejal Shah's user avatar
  • 2,141
0 votes
0 answers
22 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 ...
Priya's user avatar
  • 589
2 votes
1 answer
1k 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 ...
User0434's user avatar
  • 1,155
1 vote
0 answers
148 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 ...
blob's user avatar
  • 455
0 votes
1 answer
187 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 ...
Purushotam Sharma's user avatar
0 votes
2 answers
769 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 ...
Altravista's user avatar
1 vote
0 answers
70 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 ...
Thanh TN's user avatar
  • 307
0 votes
1 answer
448 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 ...
Praveen Negimani's user avatar
1 vote
1 answer
286 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 ...
No Dachi's user avatar
0 votes
1 answer
3k 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 ...
Vardhman Kamani's user avatar
0 votes
1 answer
55 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 ...
MageLerner's user avatar
2 votes
1 answer
206 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=...
Stack user's user avatar

1
2 3 4 5
7