Skip to Content Skip to Menu

Documentation for client-side validation API?

1 hour 52 minutes ago #343692 by BobBriscoe
Replied by BobBriscoe on topic Documentation for client-side validation API?

Where are you trying to add your custom JavaScript?

As I said, "I used the Joomla headTags module to inject my script into the head." This injects my scripts before CB's jQuery scripts (but so does CB Auto Actions - see the end of this posting).
I've tried temporarily removing my headTags config for my user profile and register menus.

Instead, I've now removed polling from my script, installed CB Auto Actions and configured as you specified, except for Method I used javaScript, not jQuery, and loaded two css / js dependencies first:
  • Method: CSS (URL) [library]
  • Method JavaScript (URL) [library script; 311kB]
  • Method JavaScript (URL) [my script; 11kB]
In my script, I've still wrapped my jQuery in this condition:
    if (window.cbjQuery && window.cbjQuery.validator) { ...}
Execution now fails to reach my validator. Using console log messages, I've found it's failing the above if() condition.
If I reinstate the polling, the above condition succeeds, and it all works again.

Or for CB Auto Actions, did you advise to use the jQuery Method specifically, knowing that JavaScript (URL) wouldn't work, for some reason?

________________
FYI, inspecting the HTML served in each case, here's a few of the salient scripts in their order in the head:...
With headTags:
    ...
    intlTelInput.css
    ...
    jquery.min.js?3.7.1
    jquery-noconflict.min.js
    ...
    intlTelInputWithUtils.min.js
    intlTelInput_cb_validation_practical.js
    ...
    jquery-3.5.1.min.js
    ...
    jquery.validate.min.js
    jquery.cbvalidate.min.js

With CB Auto Actions
    ...
    intlTelInput.css
    ...
    intlTelInputWithUtils.min.js
    intlTelInput_cb_validation_practical.js
    ...
    jquery-3.5.1.min.js
    ...
    jquery.validate.min.js
    ...
    jquery.cbvalidate.min.js



 

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 50319
  • Thanks: 8617
  • Karma: 1472
2 minutes ago #343694 by krileon
Replied by krileon on topic Documentation for client-side validation API?
Your jQuery needs to use the jQuery method. You can't put it in JavaScript as that won't be properly wrapped by the jQuery NoConflict logic and document load process. You won't even need your IF check in it. Your Code action can have 2 rows. First one being your JavaScript and the second one being your jQuery. That should then work as expected.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum