Skip to Content Skip to Menu

How to create conditional field in CB Registration

13 years 4 months ago - 13 years 4 months ago #165769 by bijal_shah19
Hi,

I want to know the Visitors information to my website. Like, by clicking on the advertisement of my website when visitor comes to my home page. I want to know from which website he came, Like, the URL of the visitors website.

Now using this information when visitor registers into my website, the selection box or textfield question on registration page like "How did you Know about us?" will automatically be selected from the website he came from.
For example. if some one comes from www.google.com then the question
"How did you know us?" will be selected as google and it can't be edited manually.
and for the regular user there will be some options in the selection box.

As i am using community builder registration. I am able to add new field like this from back end. But i dont know where to check the above condition and set the textfield value by it self.

I have used session to store the visitors information and now i want to compare the different visitor so i can set the question field of visitors website automatically.

So can anyone help me, where to put this kind of conditions in CB registration.???

Thank you in advance!!!!
Last edit: 13 years 4 months ago by bijal_shah19.

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

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 months ago #165830 by clickmo
could you not simply check if the session variable exists and set it as your form fields value through javascript then disable the field. I'm not using actual code but something like:
Code:
function onLoad() { if(sessionVariable) { document.getElementById("field").value = sessionVariable; document.getElementById("field"}.disabled= true; }

Again this is not actual code but that would be my first approach. Not really a need community builder at all.

Alternatively, to setup your own form and have complete access you can refer to creating your own user through the api: Create Users through the API

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

13 years 4 months ago #166654 by bijal_shah19
Hi,
@clickmo : thank you for this code.

But, i want to create custom field on the registration which has the session value of the visitors information. For this i have created one component which grabs the visitor's URL and stores the visitor's information into the session. So now i am having session value. But now, i want to store this session value into the database table #_comprofiler when user registers. So i can keep track of the user who is coming from the xyz website, and register him self or just leave website without registration.

Can any one how to merge new value with the insert query of the registration form?

-Thank you

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

Moderators: beatnantkrileon
Powered by Kunena Forum