Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-10034

Wrong usage of jQuery parentsUntil for forms validation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.0, 4.7.11
    • 4.1.17, 4.2.4
    • None
    • None

      In our forms in XSL, we do some error validation, and sometimes we use :

      input.parentsUntil('.field').parent().addClass('error');

      Input.parentsUntil('.field').parent().removeClass('error');

      To set the field in error or to reset it.
      This is a problem, because this will affect the whole DOM tree until either ".field" is found or we are at the root of the DOM tree. 
      There are occurences of this problem in :

      • 07_CMS pages/comments/helper/comments_3.3.xsl
      • Plugin page-subscription stylesheets/helpers/page-subscribe.xsl
      • Plugin SMS pages/services/subscribe/subscribe_1.2.xsl
      • Plugin socialnetworking stylesheets/helpers/sendByMail.xsl
        And most probably in a lot of our skins, project-side
         
        This can induce strange visual issues by setting the "error" css class where it is not supposed to be, especially when inheriting or reusing the faulty .xsl later, in projects, if the ".field" is omitted for example, or the DOM tree is different
         

            Unassigned Unassigned
            glefebvre Grégory Lefebvre (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: