[SOLVED] URL Condition or auto action for tabbed registration

10 years 2 months ago - 10 years 2 months ago #241051 by prcua
Hi Community Builder,

I am currently developing a tabbed registration for my company.
One question. I have been starting to utilize both the conditions and the auto actions plugin which are excellent plugins. Thank you for them.
However I have one question. I hope it makes sense.

Is there any way that I can make a condition or auto action that queries the url and automatically checks one checkbox option as the page is loaded?
It looks like you can do it with PHP, however I just was wondering if there is a way that would be easier instead of manual editing the plugins php files?

Just an example, please see attached image:
If url = www.prcua.org/employment
Then Registration checkbox checked = "Employment"

Please let me know if there is an easy way to do this in community builder.
Thank you very much.

-Bartek
Attachments:

Please Log in to join the conversation.

10 years 2 months ago #241059 by krileon
If I understand correctly you want to set a field value based off a value in the URL? If correct then yes this is doable. You'd do something like the following in CB Auto Actions.

Type: Code
Triggers: onBeforeRegisterFormDisplay
Access: Everybody
Conditional: [get_VARIABLE] Equal To VALUE
Method: jQuery
Code:
$( '#INPUT_ID_HERE' ).val( 'NEW_VALUE_HERE' );

Please note the above is just an example. It is not functional and you'll need to replace values as needed.


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.

10 years 2 months ago #241102 by prcua
Thanks krileon for the fast response.
I did troubleshoot your solution a number of different ways and I think that I almost got it to work.
I don't think that it is querying the url correctly. My url is www.prcua.org/employment (this is just an example, not live). I can also do www.prcua.org/employment?variable=employment

In the conditional section, I have set [get_Variable] does contain "employment"
method jQuery
code:
alert('Hello World');
$( 'cbf6943' ).attr('checked', true);

I also tried get_variable equal to full url...and a lot of different combinations.
Also I tried $( 'cbf6943' ).val('checked', true);

Nothing seemed to work, except when I put the condition to empty or does not contain. THen the alert worked but the checked checkbox did not work.

I appreciate your help.
Thanks.

-Bartek
Attachments:

Please Log in to join the conversation.

10 years 2 months ago #241109 by krileon
Your conditional is [get_VARIABLE] literally, it's just an example. That won't work. You need to grab the actual variable name. Another example as follows.

URL: index.php?option=com_comprofiler&task=registers&cb_field=1
Conditional: [get_cb_field] Equal To 1
Code:
$( '#cbf6943' ).prop( 'checked', true );

Again, the above is just an example. It is in no way tested working. It will require adjustments to fit your site specifically.

Also your jQuery selector is not valid. You need to specify # or . if it's an id or a class, etc..


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.

10 years 2 months ago #241114 by prcua
Thanks a bunch, really appreciate it. Everything works.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.223 seconds

Facebook Twitter LinkedIn