Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CiviCRM Core CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 1.1k
    • Issues 1.1k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • DevelopmentDevelopment
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #2051
Closed
Open
Issue created Sep 18, 2020 by Andie Hunt@andieDeveloper

jQuery validation not working

jQuery validation is currently not functioning in CiviCRM. The validate, cancel, and required classes on form elements are not triggering jQuery validation. The form still validates accurately, but this is server-side using Quickform.

I first noticed this in PR 17675, and I attempted to make a change there. However, that PR was delayed for unrelated reasons and there has been a lot of activity involving jQuery validate in the past few months.

  • PR 16488 attempted to apply the required attribute to required form elements.
  • PR 17929 rolled that back because it was invalid syntax.
  • PR 17937 adds the required attribute to individual radio options
  • PR 18080 #1928 (closed) switches the required on each radio option to a class name rather than an attribute

@colemanw @mattwire @seamuslee @DaveD I'm opening a PR that's mostly that one commit detached from PR 17675.

There are two problems that remain even with the PR:

  1. A required element inside a collapsed accordion won't be easily noticed. Server-side validation forces the accordion open, but the jQuery validation does not. However, I see no console errors from the result.

  2. The behavior seems to vary from form to form. The New Contribution form is quite different from New Activity. The latter seems to never use jQuery Validator. Even besides looking for POST activity, you can see the different ways the validation appears:

    With jQuery validator: image

    Server-side validation: image

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking