[SOLVED] Adding Javascript to registration form using CB Auto Action

9 years 9 months ago - 9 years 9 months ago #247260 by Freshpage
I am using CB conditional to create a multi step form, and am trying to add some Javascript code to show/hide a map on the registration form depending on which tab is selected.

I am using the CB Auto Action plugin to inject javascript using the onBeforeRegisterFormDisplay trigger. However, the DOM for the tabs is generated dynamically by Javascript which is called after my Javascript. This means that I cannot add a listener to the tabs, because they do not exist when my Javascript is called.

You can see what I am talking about here: www.dasa.org.uk.gridhosted.co.uk/registration

Can anyone suggest a way around this problem - maybe a different Auto Action trigger?

The code I am injecting using CB Auto action is as follows:

var tabCheck = {
ready : function() {
alert('tabcheck.ready() called - the tab DOM does not exist at this stage.');
jQuery('#stepbystep ul li a').click(
function(e) {
alert('Tab has been clicked');
}
);
}
};

$(document).ready(tabCheck.ready);

Please Log in to join the conversation.

9 years 9 months ago #247271 by krileon
Try ordering CB Auto Actions after CB Conditional in CB > Plugin Management. Plugin order determines load order. This should allow CB Conditional jQuery to load first before CB Auto Actions adds yours to the header.


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 to join the conversation.

9 years 9 months ago #247298 by Freshpage
That sounded hopeful, but I checked and unfortunately CB Auto actions is order number 25 and CB conditional is 20.

Please Log in to join the conversation.

9 years 9 months ago #247310 by krileon
Are you using the JS method or jQuery method? CB Conditional is using jQuery to add the step by step. If using JS try switching to jQuery as they've different output orders. Aside from that there's nothing more I can suggest as there's no after registration form trigger in 1.x.


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.
The following user(s) said Thank You: Freshpage

Please Log in to join the conversation.

9 years 9 months ago #247329 by Freshpage
Aha! Yes, the JQuery method works. Thanks, I'll mark as solved.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.279 seconds

Facebook Twitter LinkedIn