Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

dynamically text for cbc response button

I would like to dynamically update the button text for cbc response button, so that it includes word “Select” and part of brand name presented in first attribute for a given concept (e.g. first word or text commented <-- xxxx -->).
Is it somehow possible?
asked Oct 7 by RafalNeska Bronze (560 points)

1 Answer

0 votes
What I would do is add this HTML to the brand level texts:

<input type="hidden" class="conceptText" value="example"/>

Replace "example" with the text for this brand.  You may want to add an internal label so this HTML doesn't show up in analysis.

Then add this script to your CBC:

    $('#[% QuestionName() %]_div .cbc_concept').each(function(){
        var conceptText = $(this).find('.conceptText').val();
        if (conceptText) {
            var button = $(this).find('.task_select_button .input_label');
            $(button).text($(button).text() + ' ' + conceptText);
answered Oct 7 by Zachary Platinum Sawtooth Software, Inc. (183,800 points)