Hi
I am working to find a way so that during registration, the user can not choose a plan if he/she are from certain country. So, I thought of this scenario:
1-create a field and call it "country_check". This field is 'code' field-type.
2- put a code in the parameter section that return 1 if the country selected by the user is included in the list and 0 if otherwise.
3- inside the plan's workflow: use 'Conditions on CB Fields to show plan at registration' and set the condition that the value of the field "country_check" is equal to 1 in order to show the plan.
So, checking the right country and showing the plan all have to occur before the user hit the 'sign up' button.. so, I need javascript for this. I think the 'code' field type only takes PHP, right?
Can I put a javascript code inside the parameter of the 'code' field ?? If not, where? And where Should I put the .js file if needed?
My original thought was activate/deactivate plans on registration form instead of show/hide them, but I guess I can do that with javascript had I know where to put the code!
Here is the php code I thought of initially that would check for countries before I realized that I need a javascript not PHP:
There is maybe some syntax errors in the below code, I just want you to get the idea..
Code:
switch ($user->cb_country) {
case "Afghanistan":
case "Angola":
case "Bangladesh":
case "Benin":
case "Bhutan":
case "Burkina Faso":
case "Burundi":
case "Cambodia":
case "Central African Republic":
case "Chad":
case "Comoros":
case "Congo, Democratic Republic of the":
case "Djibouti":
case "Equatorial Guinea":
case "Eritrea":
case "Ethiopia":
case "Gambia, The":
case "Guinea":
case "Guinea-Bissau":
case "Haiti":
case "Kiribati":
case "Lao Peoples Democratic Republic":
case "Lesotho":
case "Liberia":
case "Madagascar":
case "Malawi":
case "Mali":
case "Mauritania":
case "Mozambique":
case "Myanmar":
case "Nepal":
case "Niger":
case "Rwanda":
case "Samoa":
case "Sao Tome and Principe":
case "Senegal":
case "Sierra Leone":
case "Solomon Islands":
case "Somalia":
case "Sudan":
case "Timor-Leste":
case "Togo":
case "Tuvalu":
case "Uganda":
case "Tanzania, United Republic of":
case "Vanuatu":
case "Yemen":
case "Zambia":
return 1;
break;
default:
return 0;
}
Thanks Alot