Question T8456
Visible to All Users

How to return array in custom function

created 3 years ago (modified 3 years ago)

i am expecting the custom function should return array in visibleIf condition so that i can apply contains on that array.
it is working for single element but if i am selecting multiple values then that contains condition is failing.
here is the example : https://plnkr.co/edit/FodUIgZ4o6DBvbZH

I need this custom function for creating array from keys of custom json. I
dont want visibleif : ' {cars} contains "string" '
because my object is custom json with key and values
any help will be appreciated.

thanks,
tejal

Answers approved by surveyjs Support

created 3 years ago

Hello,
I am not sure, what you are trying to do."{car}" is already an array.
The function has one parameter and it works in this way:

JavaScript
function isSelect(options){   var name = options[0];   var arr =[];   forvar i=0;i<name.length;i++){       arr[i]=name[i];      }   return arr; }

Thank you,
Andrew
SurveyJS Team

    Comments (1)

      yes this help.
      thank you .
      i wasn't accessing name[0] as single argument.