Is it possible to assign a value to a CB field based on a URL variable during registration?
I have 2 types of members on a site I am creating and I would like to automatically assign a value to a field during registration based on a variable I can include in the URL of the registration page like:
If it's displayed on the registration form, yes. You can set the inputs value using jQuery in a Code action on the registration form display trigger. Otherwise no, because that field won't exist in the HTML form POST data.
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.
Can the field be set to hidden to ensure registrants do not change the field value and still have this work? I tried setting the field to read only, but it could still be modified on registration.
Thanks for your help.
You can probably add the CSS Class "hidden" (without quotes) to the field in CB > Field Management to hide its row as that's a core Bootstrap 3 class. Read Only fields can still be edited during registration. Note you can not turn off registration edit for what you're wanting to work.
Your only other alternative is to use the before registration form display trigger and in a Code action with method set to jQuery grab the value from the URL and dynamically add a hidden input to the registration form. Next you need an after registration trigger that'll store that hidden input to a CB field.
Either usage should work fine, but they both are going to take some configuration. First usage should only need 1 action to populate the field. Second usage takes 2. Neither are particularly super secure as anyone could just inspect the HTML and alter the form values. Second usage is a little better than first in that regard.
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.