Forum Discussion

FICO's avatar
FICO
Community Manager
13 years ago

How to get checkbox in code template to have multi select

How to get checkbox in code template to have multi select

Hi All,

We have the questions and answer like below with questionid and answerid, need to select multiple questions through templates, and append each selected question to array of string variable?

Will it be possible to get checkbox in code template?

using variable template created a local array of string variable, will it be possible to append the selected questions to it and use the variable across my rule?

Question ID Question AnswerID Answer 1 What is pet name 1 Tom 2 What is ur mother's maiden name 2 Shelly

Please do the reply if anyone has faced similar criteria.

Thanks in advance.

6 Replies

  • FICO's avatar
    FICO
    Community Manager

    instead of listing all the questions (not sure how many questions are possible) could you use the list of and create valueholder of them with 0 or more. then instead of checking a box you could just have the user select them from the list.

  • FICO's avatar
    FICO
    Community Manager

    Hi,

    Thanks for reply, Can you please explain it much more? As am working around templates is new, so I need some more clarification on it.

  • FICO's avatar
    FICO
    Community Manager

    how are you displaying your questions?

    you can create a valuelist put them right in the list in blaze or create a generic list provider and pull them from a class outside of blaze like from a db or whatever.

    once you have the list in a provider then in your template add a valueholder and select your list provider containing the questions. then in the display part of the template place your valueholder and there should be an option to make it exactly 1, or 1 or more, or  zero or more, you pick what you want and it should allow users to pick more

    then you do the same in the srl. make sure you put a loop around the value holder in the display and srl .

  • FICO's avatar
    FICO
    Community Manager

    I've done the ways whichever you mentioned, but I couldn't able to see any CheckBox option in display format for place holder wizard, if I configure value holder with empty generic provider, only that time I got CheckBox option.

    1. Used Custom (Generic Provider) provider through BOM

    2. Called it in code template's value holder VH1

    3. set it with no arguments, and set the count to 0 or more

    4. in display format placed the holder VH1 and in its wizard no options like checkbox.

    Can't we able to achieve checkbox option through generic providers? I called this generic provider as list provider inside dual list provider and value list provider, but still no luck to get checkbox.

  • FICO's avatar
    FICO
    Community Manager

    Sorry for any confusion. What I was originally talking about was another way to possibly achieve what you were trying to do. I was not saying it would provide checkboxes.

    I don't know of a way to get check boxes to display with action tied to them. What steps i provided were steps to an alternative solution.

  • FICO's avatar
    FICO
    Community Manager

    Hi Jessy,

    AFAIK, Blaze doesn't provide check-box options out-of-the-box. Other alternative approach generally practised is to, also as Spar mentioned, create value holder of type string with '0 or more' and create the array in the SRL content.

    Hope this gives you some leads to proceed.

    Thanks & Regards,

    >> Sandesh Hiremath