Have an idea?

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

How to add dollar signs to the display of my price attribute levels?

I found a CBC where the author had a `price` attribute with levels `19`, `49`,  `69`... But when I `Preview`, the survey shows values such as `$19`, `$49`, `$69`.  I'd like to re-create what this author did (rather than enter my attribute levels directly as `$19`, `$49`, ...).

Q: How can I do this?

In the `CBC Exercise Settings` I've tried:

* editing individual attribute levels
* looking through `Conditional Relationships`
* editing the `price` attribute
* editing the `Level Text` or `Attribute Labels` via the `Format` tab.

all to no avail. What's going on?

This is in SSI Web 8.4.8
asked Oct 30 by ertingen Bronze (615 points)
Why can't you add the currency to the attribute levels themselves?
I could (which I mentioned in the question). But isn't that bad practice? Can't we save ourselves an additional cleaning step by separating the underlying numeric value from the display? This might not be a big deal for a single attribute. But there are potentially many.

1 Answer

+1 vote
Placing this code in the CBC will add a "$" before every level displayed in the fifth attribute:

<script>
$(document).ready(function(){
    $('.inner_table > tbody > tr:nth-child(5) .level_text').each(function(){
        $(this).text('$' + $(this).text().trim());
    });
})
</script>
answered Oct 30 by Zachary Platinum Sawtooth Software, Inc. (63,900 points)
Where do I place this?
Anywhere on the page.  The footer works.
Didn't work. In Lighthouse Studio 9.4.0, nothing turned up. In SSI Web 8.4.8, I get the error messages..."An error has occurred in the script on this page"..."Error: The value of the property '$' is null or undefined, not a Function object"
CBCs were reworked in 9.4.0.  The code would need to be changed to reflect that in order to work in 9.4.0 or above.

The error you are reporting in 8.4.8 sounds like jQuery is not operating.  This is what I would expect in v7 or earlier, but not in v8.  You could try reinstalling SSI Web 8.4.8 to see if that fixes the problem.
...