Hi All, I need to implement a multi-select checkbox field. Users shou

Hi All,

I need to implement a multi-select checkbox field. Users should be able to select multiple values and also may not select any fields. when they select a particular field a boolean flag is set inside the database. So each values in the checkboxfield will have a corresponding boolean flag in the database that correspond to this. All these flags are inside a CDT called "pendingCompany" and for example a sample flag would be called like pendingCompany.CompanyIsDistributor and this boolean flag would be set a value of "1" if they checked the option "distributor". My problem is I have passed in all these values as constants to the choiceLabels and choiceValues field. But I don't know what to pass in for the "value" field. so I passed in an empty array called "local!value:{}". And i have a bunch of if statements that checks if the value that is being captured is in any of the constants. If it is then i pass in a value of "1" using the cheveron op...

OriginalPostID-107346

OriginalPostID-107346

  Discussion posts and replies are publicly visible

  • ...erator. But so far I am getting a javascript error when i select on any option. Cany anybody help. This is the code:

    local!values{},

    a!checkboxField(
    label:"Location Type",

    choiceLabels:{cons!PSA_Company_Location_Types[1], cons!PSA_Company_Location_Types[2], cons!PSA_Company_Location_Types[3], cons!PSA_Company_Location_Types[4],
    cons!PSA_Company_Location_Types[5],
    cons!PSA_Company_Location_Types[6],
    cons!PSA_Company_Location_Types[7],
    cons!PSA_Company_Location_Types[8]},
    choiceValues:{{cons!PSA_Company_Location_Types[1], cons!PSA_Company_Location_Types[2], cons!PSA_Company_Location_Types[3], cons!PSA_Company_Location_Types[4],
    cons!PSA_Company_Location_Types[5],
    cons!PSA_Company_Location_Types[6],
    cons!PSA_Company_Location_Types[7],
    cons!PSA_Company_Location_Types[8]},
    value:local!values,
    saveInto:{ri!pendingCompany.CompanyIsManufacturer << if(contains(_, cons!PSA_Company_Location_Types[1]), 1,0), ri!pendingCompany.CompanyIsRetailer << if(contains(_,cons!PSA_Comp...
  • ...any_Location_Types[2]), 1, 0), ri!pendingCompany.CompanyIsPrivateLabeler << if(contains(_,cons!PSA_Company_Location_Types[3]), 1, 0),ri!pendingCompany.CompanyIsImporter << if(contains(_, cons!PSA_Company_Location_Types[4]), 1, 0), ri!pendingCompany.CompanyIsDistributor << if(contains(_, cons!PSA_Company_Location_Types[5]), 1, 0), ri!pendingCompany.CompanyIsLegalRepresentative << if(contains(_, cons!PSA_Company_Location_Types[6]), 1, 0), ri!pendingCompany.CompanyIsPRRepresentative << if(contains(_, cons!PSA_Company_Location_Types[7]), 1, 0), ri!pendingCompany.CompanyIsConsultant<< if(contains(_, cons!PSA_Company_Location_Types[8]), 1, 0)}
    )