Hi, I am working to see if I can add some functionality to be used according to CB in other component and I used below code:
<?php
global $_CB_framework;
$fieldName = "cb_test";
echo "$fieldName";
$cbUser = &CBuser::getInstance( $_CB_framework->displayedUser() );
$field = $cbUser->getField( $fieldName );
echo "$field";
if ($field == "London" ) {
...
}
What I am trying to achieve is to get the value selected by user for cb_test field.
The cb_test is a multi select dropdown field.
In the above the first echo does output the name of the field correct.
But the issue is the second echo does not output anything and it is suppose to output the value of the cb_test field.
Just to add that cb_test does definitely has value (I have tried both choosing only a single value or multi values) still output is none.
Now my first question is that is there something wrong in the code?
The second question is that for a multi-select dropdown (which values of the field can be more than one) is above code correct or it should be changed? Ideally I want to have
if ($field1 == "London" or $field2 == "London" or .....) in the end conditional where field1, field2, ... are the user selections in dropdown field cb_test.