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
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
2answers
8k views

How to submit a form to controller using ajax with magento 2 validation

My form is like this <form data-mage-init='{"validation":{}}' id="donation-request-form" method="post" data-hasrequired="* Required Fields"> <div class="row"> <div class="...
1
vote
0answers
920 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 ...
3
votes
0answers
491 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 { ...
2
votes
1answer
377 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 ...
1
vote
1answer
381 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
460 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
1answer
1k views

Magento 2 : How to make all address fields required in customer address edit form

I know there are questions here that are about how to make the address required during checkout. This is not that question. My question is how I can make all address fields required in the customer ...
2
votes
0answers
209 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 ...
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 ...
0
votes
2answers
4k views

Magento 2 - Validate input number and allow only two digits after decimal point and submit form via AJAX

Code Snippet <form data-mage-init='{"validation": {}}' data-hasrequired="<?php echo __('* Required Fields') ?>" name="vendor" method="POST" id="vendor" autocomplete="off"> <...
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 ...
2
votes
1answer
624 views

How to use addfield pattern validation

I have a custom admin form and unfortunately it doesnt have a UI component xml file. I was able to add the no-whitespace class validation. I would add also a regexp pattern, but I don't know where I ...
3
votes
0answers
294 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 ...
4
votes
1answer
1k 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" ...
0
votes
0answers
286 views

Magento Admin Form Data blank when got Session Error message

I am checking a field for unique data, I put this code: if ($data = $this->getRequest()->getPost()) { if($data['cs']['company_name']){ $checkCollection = Mage::getModel('test/...
0
votes
1answer
973 views

How to change the max limit of the attribute according to the unit?

I have a unit length that accept entering cm, inch and ft. I know how to set-up the input validation in one limit. Let say, I want to have max limit to 100cm. I can set the field validation to the ...
6
votes
1answer
8k 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"> ...
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 ...
0
votes
0answers
174 views

Validation message does not go away when “validation-passed”

I am validating my address fields for numbers. In some countries house number is mandatory to make the delivery. Since I don't care which field the number is written in, I want the validation to be ...
1
vote
2answers
2k views

Magento 2 remove validation dynamically

Hi I have a custom form where in I display configurable products with its options. The form is given validation using: <form data-mage-init='{"validation": {}}' data-form="quick-view-form" data-...
0
votes
1answer
420 views

How to call magento 2 validation with using button type is button?

I have custom form with 3 fields i.e Name, Email Id, Mobile No. require([ 'jquery', 'mage/validation' ], function($){ var dataForm = $('#product_addtocart_form'); var ignore = null; dataForm....
1
vote
1answer
620 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='{"...
10
votes
6answers
13k 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-...
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,...
1
vote
2answers
1k views

Form validation with numeric rules

I'm trying to validate input field in Magento 2. I have added js to same page, so validation like this data-validate="{required:true, 'validate-email':true}" works. But how to validate ...
1
vote
1answer
525 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 ...
0
votes
2answers
2k views

Magento:2 How to save unique values for my custom admin module

I am making a custom admin module which store custom data. I want to save unique values in table field. How I can check unique column value before save data, show error message if values already ...
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 ...
0
votes
1answer
408 views

Validation of unique value fails when updating record

I created a new field on the customer form in the admin. I did so, with an EAV attribute like this inside the InstallData: $customerSetup->addAttribute(Customer::ENTITY, self::DOCUMENT_NUMBER, [ ...
3
votes
1answer
991 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" ...
1
vote
0answers
92 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( '...
2
votes
1answer
778 views

Magento : Validation Onblur

I want to validate my form, by events onblur for every input. function validate_field(id){ Validation.validate(id); } not work for me I want to validation every single element. How to make ...
0
votes
1answer
81 views

How to validate extra field added to the customer information in admin?

In my custom module i added two extra field to the customer information displayed in admin->Customers->CustomerInformation->AccountInformation using install file. Now i want to add the ...
0
votes
1answer
551 views

Checkout form validation class if passed

I'd like to add a CSS class to form inputs in checkout when they passed the validation. Currently an error class appears when validation fails, I just want to add a passed class when validation is OK,...
-1
votes
1answer
316 views

magento2 add shipping address telephone validation start with 9

I want a validation on telephone field when adding shipping address. Number will start only with 7 Or 8 Or 9.
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 ...
3
votes
3answers
9k 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)"/> ...
2
votes
0answers
147 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 ...
1
vote
1answer
76 views

Assign two valide classes in one input field form

js/prototype/validation.js I have two classes: validate-email, validate-mobilePhoneNumber customer/form/login.phtml In email input, the customer can log with the email address or a phone number, so ...
4
votes
1answer
4k 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 ...
0
votes
2answers
2k views

How to add custom js form validation with custom error message in magento2?

I am trying to do a custom js validation for a form field, I added this in my phtml file : var theForm = new VarienForm('form-validate', true); Validation.add('validate-testx','You failed to enter baz!...
0
votes
1answer
94 views

Backlash in email, still Magento validate-email don't respond

/js/prototype/validation.js ["validate-email","Please enter a valid email address. For example johndoe@domain.com.",function(e){return Validation.get("IsEmpty").test(e)||/^([a-z0-9,!\#\$%&'\*\+\/=...
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 ...
1
vote
2answers
3k views

Magento 2 minimum length validation is not working for text field

Magento 2 minimum length validation is not working for text field. My code lines: <input type="text" tabindex="3" class="input-text required-entry validate-length maximum-length-8 minimum-...
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 ...
1
vote
2answers
32 views

Made a custom form module, form commits to database before entering values

I have made a custom form module. However, the module already commits the "values" when I enter the page instead of after entering values and pressing on "submit". So every time I refresh the page my ...