A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
33
votes
7answers
54k views

Magento 2 - Form Validation

is there a overview for the new form validation attributes in Magento 2?
23
votes
9answers
20k views

CE1.9.1 Please make sure your password match issue during User registration

I am encountering this issue in CE1.9.1. When a User registers (doesn't matter if it's during checkout or from the Create an Account link) the user keeps getting the password mismatch error even ...
17
votes
3answers
7k views

Magento 2 add custom product attribute validation from install script

[ 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'XXXX', 'input' => 'text', 'frontend_class' => 'validate-greater-than-zero', 'source' => '', 'global' =>...
12
votes
1answer
6k views

magento2: how validation work in magento2

In magento1 we can check validation like this: var formToValidate = $('form-validate'); var validator = new Validation(formToValidate); if(validator.validate()) { // Here we can code ...
11
votes
1answer
2k views

Frontend form key is being overwritten

I am currently having issues with frontend forms where the form keys are somehow being overwritten and displaying incorrect form keys. I am currently debugging this issue on the customer login form. ...
10
votes
8answers
16k views

SUPEE-9767 Magento CE 1.9.3.3 Onestep Checkout not working with Form Key Validation On Checkout enabled [duplicate]

After upgrading to Magento CE 1.9.3.3, when I enable Form Key Validation on Checkout as recommended by SUPEE-9767 onestep checkout stops working. After selecting a payment method, when I click ...
9
votes
6answers
12k views

How to Validate the Google reCaptcha

I have added the google recaptcha in contact us form but value is also submitting without captcha. I have used in my contact page following codes for captcha: <div class="g-recaptcha" data-...
9
votes
2answers
5k views

Validating form elements built via ui-components

I'm trying to have a custom validation to one of my Magento 2 form fields that is generated via ui-components. I know that I can make the value required by adding a validation item in the config. Like ...
8
votes
1answer
965 views

Error message “Please enter valid date”

I am getting an error message when I use any date field for products or coupons. It tells me to enter a valid date. The dates are valid and there is no range that satisfies the system. Some payment ...
7
votes
2answers
14k views

magento 2: trigger js form validation without submit

On a custom frontend page I have a form in which I use magento's js validation to validate inputs: name, email description, etc. When the form is submitted the validation is triggered and works ...
7
votes
0answers
2k views

Magento 2 : Validate form fields that are loaded with Knockout on blur-event

I have a form that is generated through a .phtml file, and in this form various fields are loaded with KnockOut (using the uiComponent javascript-object). .phtml: <form action="#" class="form ...
6
votes
3answers
11k views

Magento 2: phone number validation (only accepts numbers)

In Magento 2, I want to make phone fields number validation, (eg in the checkout page) only accepts numbers (and not characters)?
6
votes
2answers
13k views

Form Key Value in template and controller

The following function is used to get the form key in templates with type hidden. My customerController.php does not validate the form key with the method _validateFormKey(). When I echo the following ...
6
votes
4answers
927 views

Magento2 How to add custom validation for password?

I want to change default validation for all password field. I want to change for all password field and validation is minimum 8 characters and at least one number include. Can anyone help me with ...
6
votes
1answer
618 views

magento 2 UI Component form Character Limit Validation

How to create custom Validation for UI Component Form? I want to create Validation for maximum character, not for max-word which is already available in Magento 2. if any body knows please share the ...
5
votes
2answers
7k views

Magento 2 form validation: minimum/maximum length

I'm trying to add some of the predefined validation to a form element but currently am failing. As fas as I can tell, all the validation rules can be added via classes, but no where does it say how to ...
5
votes
1answer
6k views

How to make the second address field required during checkout?

I have config set to display 2 lines for address during checkout (Configuration → Customer → Customer Configuration → Name and Address Options): Number of lines in a street address: 2 How can I make ...
5
votes
5answers
11k views

Is there a callback I can use after a form has been validated?

I have to reflow the Foundation equalizer on a page that contains a form [contact page] - if validation failsthe form will overlap the footer with the added validation error elements. <script ...
5
votes
1answer
2k views

Validation does not work in admin forms

I followed the advices of https://magento.stackexchange.com/a/8785/9489 and succeed to get that : $fieldsetImage->addField('logo_big', 'image', array( 'label' => Mage::...
5
votes
0answers
888 views

CE 1.9.2 - Date of Birth validation at checkout not working [closed]

I cannot for the life of me understand what is happening with the Date of Birth field in Checkout or Registration. I've set it as Required under Customer Configuration, and have the date fields order ...
4
votes
1answer
6k views

UI form validation in Magento 2

I want to validate text field to numeric or not in UI form. <column name="sortorder"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> ...
4
votes
3answers
16k views

Magento 2 how to validate form and display error message below input field

In magento 1.x we use the following code to validate Magento forms: <script type="text/javascript"> var myForm= new VarienForm('contactstore', true); </script> I am using this code ...
4
votes
1answer
5k views

Magento 2.2 Input field validation on Checkout page

In /vendor/magento/module-checkout/Block/Checkout/LayoutProcessor.php, I can find blow code (getBillingAddressComponent), which is used to validate the billing address input fields, and I can change ...
4
votes
3answers
2k views

What is the cleanest way to enforce length limitations on customer's address in admin panel?

For a client we're exporting all the address information that goes into Magento into a third party processing system. The details about this is unimportant - but what is important is that things go ...
4
votes
1answer
281 views

setElementsRelation method in VarienForm

There's a setElementsRelation in VarienForm JS class. The idea of this method is quite interesting but all calls in template files are commented out. Does anyone have any idea if it is just a sort of ...
4
votes
1answer
2k views

Magento 2.1 How to apply validation to custom credit card form?

I have created my credit card form. Then when I will click on Place Order button <div class="actions-toolbar"> <div class="primary"> <button class="action primary ...
4
votes
1answer
1k views

Magento-2 Validate input field without form

How to validate email input field without form? I have tried with below code but not working. <input class="input-text" type="email" data-validate="{required:true, 'validate-email':...
4
votes
0answers
427 views

Before place order validation in magento2

In magento2 before place order check new customer form (billing address form) open and filed is not fill then not place order and show message please fill the form then place order, now in magento2 ...
4
votes
0answers
823 views

How to allow all special characters in magento password field?

I am trying to allow all special characters in register page in password field. As of now it only allows /[$@$!%*?&#^ ]/ But I want to allow all. like: ^[@!#\$\^%&*()+=-[]\\';,./{}\|\":<>...
3
votes
3answers
8k views

How can we validate individual form field In Magento 2?

In Magento 1.x we can validate individual form field like. <input class="input-text required-entry" id="name" title="First Name" type="text" name="name" value="" onblur="validate(this)"/> ...
3
votes
3answers
6k views

Magento 2: How to set Max Length for Street Address?

I would like to set Max Length for Customer's Street Address 1 to 50 Characters & Street Address 2 to 100 Characters. Changes will be applied on Frontend only, where we can find Street Address. ...
3
votes
4answers
12k views

Validate input filed without form

I really need to have custom or even magento validation for my input field. Problem is, there is no form in my field, there is only input field. <input id="item_custom_payment_" name="...
3
votes
2answers
3k views

I want to load ajax loader image after clicking save button

I am using magento 1.9 version. After clicking save or any button then I want to show progress by ajax loader. I found a div having ID "loading-mask". If i will change its style display:none to block ...
3
votes
1answer
3k views

Adding custom global javascript validation

I have done some digging in internet but I haven't found any confirmed solution. What is the way to add custom js validation rule, that can be used globally as for example frontend_class for ...
3
votes
1answer
3k views

Error in validating minimum length for text field

I have used the below <input type="text" value="" class="input-text required-entry validate-number validate-length minimum-length-4 maximum-length-8" title="Purchase Order" name="custom1" id="...
3
votes
2answers
2k views

validate-select not working

I have this form where validation for upload file works but validation for dropdown isn't working. <form name="designer-upload" class="designer-uploads form-group" id="designer-upload" action="...
3
votes
1answer
869 views

Custom added field to checkout is not validating when I go the next step

I've added a date of birth field to the checkout in Magento 2 like so: <body> <referenceBlock name="checkout.root"> <arguments> <argument name="jsLayout" ...
3
votes
1answer
480 views

URL Key for product doesn't accept hyphens

When editing a product I migrated over from a woocommerce store and NOT changing the URL Key I get the following error. Hyphens are a must in URL Keys, what can I do Thanks! EDIT: Disabling the ...
3
votes
1answer
379 views

Register password strength meter not working in Magento 2.2.5 CE

I have a fresh installation of Magento 2.2.5 CE & tried to create new user on frontend when we type password like Password1 strangely strength meter not showing like weak, strong, very strong its ...
3
votes
1answer
386 views

Move up Validation in Configurable Product Page

Is it possible to move up label, below the fields? And where I can find it? I tried in validation.js, but didn't have much luck.
3
votes
2answers
1k views

Magento 2.0 Make Javascript Required Field Validation Conditional

is it possible to make data-validate="{required:true}" conditional? I need to make the validation trigger only if Synch To Rahaha dropdown field is YES. What changes are needed to make it happen?
3
votes
1answer
4k views

How to check all the validations are passed in magento form?

I want to check if all the validations are passed in magento billing form what i have tried is <script type="text/javascript"> //<![CDATA[ var billingForm = new VarienForm('...
3
votes
2answers
48 views

How to validate Magento 2 form field input value with database table field to find out if already exists?

I have added following affiliate email field (custom attribute) to the customer registration form. Now I want to validate that if value already exists in the database table. <div class="control"&...
3
votes
1answer
2k views

Magento 2 Custom Validation on Address Book (street[1])

For the checkout screen (custom OneStepCheckout plugin) I managed to succesfully add a custom validation rule on the second street input. Now I'd like to do the same for the default Address Book pages,...
3
votes
1answer
772 views

UI Component Form Validation: Pattern method

I've got an admin ui_component form which has a listing of fields and I'm adding validation to them. One I'd like to use a custom pattern. The form in general works, it's just this "pattern" ...
3
votes
1answer
3k views

How Can I apply server side validation in magento 2

I am new to magento 2, and I want to apply server side validations, Can anyone please help me, Or suggest me how to apply. I have searched many links for this but i didnot understand. Here is my phtml ...
3
votes
1answer
1k views

Magento 2: Custom validation for system.xml

Is it possible to create a custom validation for fields in configuration? (Stores > Settings > configuration) I created a system.xml file but the default values for the validate tag are not enough ...
3
votes
1answer
297 views

Custom Checkout Validation - Two fields must have the same value : M2

I have read this URL for equalTo validation. I have add custom field using LayoutProcessor.php file and set validation like this : 'validation' => ['validate-no-empty' => false,'validate-...
3
votes
0answers
255 views

Validate Ui Component

Validate Ui Component generated form fields inside dynamic rows container that are dependent of another field value There is a possibility to add one or more addresses for a new/existing customer ...
3
votes
1answer
1k views

Magento registration returns 'Last name cannot be empty'

I am trying to deploy Magento 1.9.2.1. I used the package from the official site. But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation ...