Questions tagged [form-validation]

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

104 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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. ...
8
votes
1answer
1k 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
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 ...
4
votes
0answers
463 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
852 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
0answers
477 views

Validate Multiple Custom Forms on same PHTML file

Validate Multiple Custom Forms on same PHTML file. I have 3 forms on same phtml file i trying to validate the input fields. One time one form is shown Sign In { if successful} WriteReview { ...
3
votes
0answers
284 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 ...
3
votes
0answers
454 views

Email validation in registration form to exclude example addresses

My current registration form only validates the proper input email format. Where my validation.js file has ['validate-email', 'Please enter a valid email address. For example johndoe@domain.com.', ...
2
votes
1answer
71 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=...
2
votes
1answer
391 views

How to validate form fields such as city, zipcode in address form

I have done form validation as follows <form class="form-address-edit" action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" id="form-validate" enctype="...
2
votes
0answers
328 views

How to remove validation from the “City” and “Street Address” Field on Customer Registration Page?

I've added "Address Information" on customer registration page & want to remove the mandatory field from the "City" and "Street Address" Field for that I've overrided register.phtml file on my ...
2
votes
1answer
351 views

Magento 2 Admin customer form range validation is not working?

I want to add range validation for mobile , i have added "validation-digits-range" rule in ui component xml. I have declared range as 9-13 and I enter correct 10 digits still asking "The value is not ...
2
votes
0answers
1k views

How to remove review summary field in product review form in magento 2

I need to remove review summary field in product review form.I have modified the core review form in my custom form. But Now, I need to remove validation for review summary field in Product review ...
2
votes
0answers
195 views

How to make product ratings required in Magento 2.1.2

For some reason the star ratings are not being validated on the product page (Product Review). The other 3 fields are being validated correctly (Nickname, Summary, & Review). Has anyone ...
2
votes
0answers
146 views

Customer Login - form_key validation fails - Magento 2

Hi i am trying to login to the customer but it redirects to login page. I checked in there is form_key validation in LoginPost.php it redirects to the same page. But the same thing is working on live ...
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 ...
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
0answers
18 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
40 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 ...
1
vote
0answers
19 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 { ...
1
vote
0answers
26 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 ...
1
vote
0answers
63 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 ...
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 ...
1
vote
1answer
57 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 ...
1
vote
0answers
68 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="...
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.
1
vote
0answers
35 views

Magento 2.3 validate form instant

I want to validate the form on our Magento 2.3 store instant. So when a value is added into the input field, it should validate this instant and add some css class or id to the input field. In that ...
1
vote
0answers
116 views

Magento 2.3. changing form validation options loses validation messages translations

I am running Magento 2.3. In the customer create account form I changed the way validation form errors are shown in this way: var dataForm = $('#form-validate'); dataForm.mage('validation', { ...
1
vote
1answer
87 views

Magento 1.9 - Add custom zipcode validation on Home page

Validate a zip code field on a home page popup in Magento 1.9 style might be using jquery button click.
1
vote
0answers
297 views

Custom form field not showing validation message

I have created one custom form and implemented magento validation. Magento validation works for all fields but message of one field is not displaying. I have added datepicker in this field. Below is ...
1
vote
0answers
24 views

Translating Error Messages on Address Form

When only entering a few Required Fields when logged in and Adding a new address. And then submitting that form, the error messages come back in English and not the translated format that is required....
1
vote
1answer
770 views

Magento 2 - Please enter less or equal than 255 symbols valiadtion error in checkout page

Magento 2 - Please enter less or equal than 255 symbols error message in add new shipping address popup form Currently i am getting an error validation message when i open the add new address form to ...
1
vote
2answers
473 views

How to do the server side validation for login form?

I have done client-side validation but how to do the server side validation for the login form.
1
vote
1answer
431 views

How to hide specific days from admin form calendar field in magento 2

I want to disable week days (Saturday & Sunday) in admin form calendar field. check below screen-shoot. Below is my field code. $fieldsetDirector->addField( 'attendance', 'date', ...
1
vote
0answers
51 views

Magento 1.8.x: Validate 'Add to Cart' Button on Category View

I'm trying to add form validation on the category view and to show error message on the category page. Currently, if there's an error it will redirect you to the product view page and display the ...
1
vote
0answers
275 views

Magento 2 : How To Customize Validation Error Message

Is there a way to add a custom error message to a custom validator? I use already the default rule required-entry, can I define my own rules? and where exactly? I found something with overwriting ...
1
vote
0answers
20 views

Magento 1 - Custom required formfield on checkout

I have added a custom textarea field on the shippingmethode section. That field needs to be required. Is there any way to do this? Basicly it has this content; https://jsfiddle.net/bbsrsbbd/1/ <...
1
vote
0answers
868 views

How to remove validation error message upon input field change?

I have installed a module that adds another payment method, which has additional input options, and I want to make those options mandatory. I've added a validator to validate #co-payment-form's input ...
1
vote
0answers
40 views

Addrees field validation label not showing required mark

Hi i have a shipping address form with fields like following image. In which street address field is required field but it don't have star mark. I want to add red star after label but i didn't found ...
1
vote
1answer
372 views

Magento 2 - Single Time Picker error on save

I have already added new form field - time picker. When I'm trying to save form, post value is overridden on "Invalid date". <field name="flight_hour" formElement="date" sortOrder="40"> ...
1
vote
1answer
447 views

How to add unique mobile number function in Magento 2 registration form?

I used this link How can i add a field mobile number at the time of customer registration form in magento 2? to add mobile number field in the registration form which works fine. But I need to ...
1
vote
0answers
55 views

Input fields goes missing in Sales Order Form when there is error

I am creating a new order from admin panel i.e Sales -> Orders -> Create New Order After filling the form when i hit submit order it throws error but the input fields in FORM which i already have ...
1
vote
0answers
165 views

Magento 2 : Required fields in checkout are no longer required

I have a strange issue in Magento 2 (2.1.9), and I was wondering if anyone encountered something like this before. The required fields in the checkout usually have a required-class, but for some ...
1
vote
1answer
574 views

How to change data-validate attribute of a field?

I have a following form <form name="addForm" method="POST" enctype="multipart/form-data" action="someurl" data-hasrequired="<?php echo __('* Required Fields') ?>" data-mage-init='{"...
1
vote
1answer
520 views

Remove fields from registration form

I'm trying to modify my registration form on Magento removing the firstname, lastname and the password confirmation. At the moment I've changed the "is_required" in the "eav_attribute" table for ...
1
vote
0answers
89 views

set min and max values for a field dynamically based on the value of drop down selected in magento

https://jsfiddle.net/05Ldg6uv/6/ I tried using angularJs referring the above link but the min and max fields did not get set in magento. $setup->addAttribute('customer', 'nickname', array( '...
1
vote
1answer
5k views

Add Custom Validation Rule Magento 2 Validate.js

I am using the following code on a form to use the validation.js library to validate the form. One of the validation files uses ./rules.js to extend the rules used within the validator which I have ...
1
vote
0answers
2k views

Magento 2: Checkbox Validation

I have displayed a frontend form. The form has a checkbox field and it is a mandatory field. But the validation for the field is not working. Please help. This is my phtml file: <div class="field ...
1
vote
0answers
1k views

Magento 2 checkout input field validation possibility

I have searched in web two days how to validate checkout fields without any luck. All the research I have made have risen some questions because tutorials I have found are all about custom-form ...