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
1
vote
1answer
6k views

How to redirect to previous page with message in magento 2 frontend?

I have a form that post data to controller in Magento 2 Frontend, i want to do some validation, and redirect back to previous page after validation with success or error message, here's how i redirect ...
2
votes
1answer
5k views

Validate mobile number in magento 2

Hi i want to validate the mobile number in custom module my code is <input type="text" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits" id='...
2
votes
1answer
1k views

Magento 2: Disable past dates for the Datepicker built via ui-component

I am trying to add a validation to the datepicker so that users won't be able to select past dates. The datepicker is built via ui-component and the code snippet is as follows: I have checked this ...
3
votes
2answers
2k views

magento 2: how to make validation on same name array input

I want a validation on same name array dynamic input textbox.Because Magento data-validate="{required:true}" is not work on same name so how to validate same name array input validation.I have ...
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. ...
1
vote
1answer
472 views

To add one single validation for checkbox group and input field

I have created a custom form in magento 2. I have placed a checkbox group having different company names as checkbox values like cmpy1, cmpy2, cmpy3 etc. I have also added an input field inside that ...
0
votes
2answers
3k views

Magento 2: Post Code isn't being validated as 'required' on Checkout

On my theme, the customer is allowed to proceed to the payment page of the checkout without having to add a Postcode, despite it being set as required. The other fields (Street, City) are required and ...
17
votes
3answers
9k 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' =>...
4
votes
1answer
3k 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 ...
2
votes
1answer
454 views

Validate website url in magento 1.9

I have used website url input in my registration page for Magento 1. All things are working fine but its validation is not working for all counties. Ex: www.example.com (no error) www.example.in (...
4
votes
0answers
854 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: ^[@!#\$\^%&*()+=-[]\\';,./{}\|\":<>...
1
vote
0answers
134 views

Magento product detailed page Varien form hidden field validation not working

I have work with Magento1.9.3, then in my product detailed page i have added some hidden dropdown fields. When i was used the Prototype(1.7.0) js, the hidden field validation was wroked without any ...
5
votes
2answers
10k 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 ...
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 ...
1
vote
2answers
787 views

how to set unique field in my custom module

I am using magento 1.9.2.4 I need to one unique and require field in my custom module form I am using below code for form field class Test_Brand_Block_Adminhtml_Brand_Edit_Form extends ...
1
vote
3answers
654 views

How to get post data variables from textbox after submition a form in magento

How do I get data of post variables ? Like if I post form with post method then I can get it with $_POST or not this is my form <form id="orderapproval-item-form" class="orderapproval-hidden" ...
4
votes
3answers
7k 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. ...
2
votes
0answers
225 views

Manage checkout form validation (required fields) with ajax

How can I manage checkout page required fields programmatically. I want to Add or remove required fields with ajax based on customer selected parameter (country, shipping method...)? I have read the ...
3
votes
1answer
449 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.
2
votes
1answer
7k views

Magento 2: How to validate the radio box and show required message? [duplicate]

I want to make the required radio box on submitting form. Validation works but it not showing the error message as "This is required field" <div class="control"> <input type="radio" ...
0
votes
1answer
991 views

Magento 2 Checkout Validation doesn't work

I've created a module which extends the magento 2 checkout, where I've added another field according with the magento documentation: http://devdocs.magento.com/guides/v2.0/howdoi/checkout/...
1
vote
1answer
620 views

Custom Checkout Validation - Two fields must have the same value

I've created a module which adds an additional field to the checkout, called 'email-confirm'. I want to check that the value in this field is equal to the first email entry, but I'm unsure how to do ...
1
vote
0answers
46 views

Dont allow advanced search to click “search” without enter any search term

by default magento advanced search allows to click the search button without even enter some search words. In my magento this leads to a few seconds of waiting until you finally get a "no products ...
1
vote
2answers
4k views

How to validate telephone field in billing information

I want to apply validation with 10 digit mobile number on telephone field in billing information in magento checkout page. For this I tried pattern="\d{10}" with type="tel" but it is not working. ...
1
vote
0answers
700 views

magento2 admin form validation

Could somebody help me to apply form validation directly in admin html files? Here is my code for example: <form method="post" id="commercial_invoice_create_form" name="...
8
votes
2answers
17k 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 ...
0
votes
2answers
1k views

Validate Frontend Form in Magento

I have the below Calculator Form which I'm creating in Magento that I would like to be able to use Magento's in-built JavaScript validations, even though I need to validate on a button click rather ...
1
vote
2answers
2k views

Validation callback in magento2

var dataForm = jQuery('#form'); dataForm.mage('validation'); function submitForm(){ if (dataForm.valid()){ dataForm.submit(); } } Everything is working well what i ...
0
votes
1answer
3k views

Magento 2 form validation - accessing mage/validation/validation.js return values?

This is my first go at a Magento 2, so please bear with me. I want to add functionality that scrolls the page to an error message if a form does not pass validation. Currently, I am listening for a ...
12
votes
2answers
6k 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 ...
2
votes
1answer
2k views

Magento2- UI Component - Remove form validation for telephone

I have tried to override the form validation for telephone which added in core file vendor\magento\module-customer\view\base\ui_component\customer_form.xml as follow: <field name="telephone"> ...
1
vote
1answer
632 views

Custom checkboxes form Validation - Magento

I have 2 checkbox fields and only one of them have to be required (the first or the second) How can I show an error message only if the 2 checkboxes are not selected. It is possible to do that with ...
2
votes
1answer
111 views

uiForm validation?

I found this list validation rules: Magento 2 - Form Validation How to use above list of validation rules in uiForm-uiComponent. Can I add it inside xml <field> tag? or at least how to set ...
1
vote
1answer
73 views

Adding required field

I am using a module to process product returns, but unfortunatly the comment field is not required. I would like to add the check that people have to fill out WHY they return the product. As far as I ...
1
vote
0answers
739 views

how to create custom contact form based on base contact form in magento

I am creating a order form i used default magento contact form add many extra fields also defined in admin but how can i link form with template in admin ? because i want contact us form should stay ...
0
votes
1answer
1k views

How to scroll to first error in Magento 1.9 product page?

Hi guys I would like to scroll to the first erroneous input on the product page. Currently it doesn't and stays at the bottom. You then have to manually scroll up till you see the swatch option group ...
1
vote
1answer
1k views

Magento 2 - jQuery validation custom error message

I have the following input that requires validation. When the remote method is failed, it displays an error message Please fix this field.. How can I customize this message? <input type="text" ...
2
votes
1answer
3k views

Magento 2: Image Upload JS Validation

I'm going to upload one image. I need to put below validations on Client side & Server Side Allowed file formats: jpeg, jpg, png Max. File Size is 5MB. Image size should be 100 Width x 100 ...
1
vote
1answer
176 views

Magento 2: Image Upload Not Calling Validator

I'm using Magento 2 CE Version 2.1.0. I would like to validate that uploaded image should not exceed 5MB. app\code\Custom\Module\Controller\Posts\Post.php public function execute() { $uploader = ...
1
vote
3answers
7k views

Input value must contain number higher than 5

In my contactform I want to display a inputfield, that may only contain a number, higher than 5. How can I achieve that? My current code is: <li> <div class="field"> ...
1
vote
0answers
716 views

Magento 2 - Form Validation Translation [duplicate]

I have a problem with magento 2 forma validation translation. Not all fields are translated. (The Geburtsdatum and E-Mail field) In my translation file de_DE.csv "Please enter a valid email address ...
1
vote
1answer
2k views

Form validation with Custom error placement in magento2

In my form i need to show validation message of specific field in my predefined or specific div, how to do it in Magento2?
1
vote
1answer
542 views

First Name and Last Name not allowing to use Latin letter

I am Using Magento 1.9.1 Gómez nº these letters are not allowing in my customer form. please help.
1
vote
1answer
1k views

M2: Custom form validation

I have an ajax form I need to call before allowing user to continue to add a product to cart. I have the form popping up but I also need to validate the contents before it submits. However the ...
0
votes
1answer
71 views

Delete Phone Number validation, Error in Forms

I want to remove phone validation from this form below, it's not accepting any phone number, the file is smiple_contact.phtml but I am not sure what code to delete. Thanks. http://www.b2zee.com/b2c/...
0
votes
1answer
264 views

Unable to validate magento custom login form in fancybox

I am trying to validate the following form in fancybox popup but it keeps on submitting the form instead of doing the validation what am I doing wrong in this? This works perfectly when Outside ...
0
votes
1answer
1k views

How to use Magento's default form validation in a pop-up?

I have a form in a popup that I've been trying to use the default Magento validation with. I tried various tutorials with no luck. Even tried HTML5. What happens is if someone just clicks the submit ...
1
vote
1answer
619 views

International phone numbers validation

I've tried many regex, but I'm still not able to find the one for accepting these kind of phone numbers: 003466655544 and +34666555444 and (+34)666555444
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="...