• Home
  • Blog
  • Documentation
  • FAQ
    • Pre-Sales Questions
  • Sign Up
  • Log Out
  • Get Easy Forms
  • Home
  • Blog
  • Documentation
  • FAQ
    • Pre-Sales Questions
  • Sign Up
  • Log Out
  • Get Easy Forms
home/Knowledge Base/Developers "How To's"/How to compare two fields to pass the validation (jQuery Validation)
Popular Search:Getting Started

How to compare two fields to pass the validation (jQuery Validation)

1170 views 1 June 1, 2020 admin

To match two fields with the jQuery Validation plugin and the “equalTo” method just follow the next steps:

1. Go to Forms -> Actions -> Settings -> UI Settings -> Load Javascript File and Enter the absolute url to the following file:

https://www.example.com/static_files/js/demo/jquery.validation.equalTo.js

Note: Don’t forget to use your domain name.

2. With the Form Builder add the following Css Class to both fields to compare:

– To the first field (e.g. Password) add the Css Class: first_field
– To the second field (e.g. Confirm Password) add the Css Class: second_field

And that’s it! Test your form!

How to Customize the Validation Error Message

First, I suggest copying our demo javascript file outside the application, and update its absolute URL on Form Settings -> UI Settings.

Then, to customize the validation error message, just edit the text of this line:

$.validator.messages.equalTo = 'Please enter the same value again.';

And if you want to change the css class names, just replace ‘first_field‘ and ‘second_field‘ in the following lines:

$.validator.addClassRules('second_field', {
    equalTo: ".first_field"
});

Then do the same with the Form Builder.

That’s all!

This example introduces you how to use the jQuery Validation plugin with Easy Forms; of course, you can create your own validation rules and use them with your forms.

Ref. | jQuery Validation Plugin

Was this helpful?

1 Yes  No
Related Articles
  • How can I add custom css styles to radio buttons?
  • How To remove “For more details please go here” from the email notifications
  • How to set the PHP CLI path in the application
  • How To Change the Login Page Slogan
  • How To Remove the Logo from the Form page
  • How To Add A Tracking Code to your Forms
Leave A Comment Cancel reply

You must be logged in to post a comment.

Developers "How To's"
  • How to compare two fields to pass the validation (jQuery Validation)
  • How can I add custom css styles to radio buttons?
  • How To remove “For more details please go here” from the email notifications
  • How to set the PHP CLI path in the application
  • How To Change the Login Page Slogan
  • How To Remove the Logo from the Form page
View All 16  
Popular Articles
  • How to enable / disable DEBUG mode
  • How to update Form Stats from the command line
  • How to RTL (right-to-left) a Form?
  • How to Remove the Default Choice from a Select List Field
  • How to Insert an Image into a Notification or Confirmation Email
KB Categories
  • Add-Ons
  • Advanced Techniques
  • Common Issues & Troubleshooting
  • Developers "How To's"
  • Getting Started
  • How To
About Easy Forms

With Easy Forms you can create unlimited web forms and most importantly the complete management of them without paying monthly fees

Resources
  • Knowledge Base
  • Documentation
  • Pre-sales Questions
  • Blog
Useful Help Links
  • Get Easy Forms
  • Live Demo
  • License Terms
  • Contact Us
Frequent Visit Links
  • Pre-Sales Questions
  • System Requirements
  • Installing Easy Forms
  • Upgrading Easy Forms
  • Privacy Policy
  • © 2015 - 2021 Baluart EIRL. All Rights Reserved.

Popular Search:Getting Started