• About
    • Blog
    • Business Process
    • Charity Work
    • History
    • News
  • Services
    • Legacy System Support
    • Bespoke System Development
    • Web Design & Development
    • View all services
  • Products
  • Our work
    • Customers
    • Case Studies
  • Careers
  • Contact
Microsoft Partner - Application Development
7th June 2016

jQuery Form Validator

jQuery PSP Knowledge Tutorial
jQuery Form Validator

Recently I had to add some client side validation to a form, after some research I came across one jquery plugin that I particularly liked.

It is called formvalidator (http://www.formvalidator.net/), it has some good functions however I couldn't get it to do two things that I needed.

1. I needed the ability for when a page loaded for it to validate data that already existed in a field, below is an example of how to do this.

I created a new function and then when once the modules have loaded then it will call my function, I had to set a timeout and then call blur on the element so that form validator would realise that there is a value and therefore validate it.

2. Form validator has a built in Password confirmation, however at the time it would not work with my elements (this may now have been resolved). This was due to using two asp:TextBox's

Here is what my HTML looked like.

So my solution to this problem was to write my own custom validator, see below for an example.

One limitation of the code below is that it has to be on the same page as the id for confId, however this wasn't an issue for me as I only needed this on the one page, however when I need it on two pages I shall refactor it so that it will pull this id from a data attribute from the current element.

I hope that the above was useful, if you have any questions or suggestions then I would like to hear from you!

Share:
PSP IT Design & Development
About Us
  • Privacy Policy
  • History
  • Customers
  • News
  • Blogs
Services
  • Legacy System Modernisation
  • Website Design & Development
  • Bespoke Application Development
  • Outsource IT Strategy
  • All Services
Contact
  • 01775 722377
  • letstalk@psp-it.co.uk
  • Carver House, Apex Court, Spalding Office Park, Elsoms Way, Pinchbeck, Spalding,Lincolnshire, PE11 3UL

Terms & Conditions Privacy Policy

© PSP People Systems Process Ltd. 2022. All Rights Reserved.

MENU

MENU

  • About

    • Blog

    • Business Process

    • Charity Work

    • History

    • News

  • Services

    • Legacy System Support

    • Bespoke System Development

    • Web Design & Development

    • View all services

  • Products

  • Our work

    • Customers

    • Case Studies

  • Careers

  • Contact

© PSP People Systems Process Ltd. 2022. All Rights Reserved. Privacy Policy

give us a call
01775 722377
drop us an email