Questions tagged [form-validation]
Denotes question related to form validation. form validation contain frontend forms, adminhtml forms, UI components based forms
108
questions with no upvoted or accepted answers
11
votes
2answers
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
2k 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 ...
8
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
485 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
868 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
514 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
309 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
457 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
95 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
543 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
337 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 ...
2
votes
0answers
418 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
411 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
219 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
150 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
226 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
0answers
785 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="...
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
170 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:
...
1
vote
0answers
79 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
64 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
53 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
39 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
86 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
74 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
982 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 ...
1
vote
0answers
101 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
38 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
117 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
295 views
error “File Input” is required value Magento 2
I have a customer attribute that is "File Input", type is file and require is true but I do not let it show in customer register. When I try to create an account it displays the error like this:
How ...
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
1k 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
546 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
551 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
53 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
299 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
985 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
43 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
393 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
491 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
56 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
166 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
694 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
530 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
103 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(
'...