Have an idea?

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

Custom CBC under SSI Web 7 (Free Format): Autosum Prices of Selected Options & Question Toggle

Dear Forum Users,

I am using custom CBC (free format) under SSI Web 7 to allow for multiple choices in an ordninary CBC. There are three choices and a none option. Using JavaScript I would like to do the following:

1. Toggle 3 product options off, when None is clicked. Here is my according code:

<script type="text/javascript">

var toggle_list = ['fftRandom1_response_1', 'fftRandom1_response_2', 'fftRandom1_response_3'];

function toggle(checkbox) {
if (checkbox.disabled) {
} else {
checkbox.setAttribute('disabled', true);

function toggleActivation() {
for (var i=0; i<toggle_list.length; i++) {
var id = toggle_list[i];
var checkbox = document.getElementById(id);


2. Autosum the prices of selected options to arrive at a total price. Here is my script:

<script type="text/javascript">

function UpdateCost() {
var sum = 0;
var gn, elem;
for (i=1; i<4; i++) {
gn = 'fftRandom1_response_'+i;
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
document.getElementById('totalcost' ).value = sum.toFixed(2);


Here are the according code for the checkboxes:

<td class="input_cell clickable alt_color1" width="22%" nowrap >
<input name="fftRandom1_response_1" value="[%CBCDesignLevelText (CBC01_random1,1,3)%]" type="checkbox" id="fftRandom1_response_1" class="HideElement" onclick="UpdateCost()">
<div id="fftRandom1_response_1_graphical" class="graphical_select checkbox"></div></td>

<td class="input_cell clickable alt_color2" width="22%" nowrap >
<input name="fftRandom1_response_2" value="[%CBCDesignLevelText (CBC01_random1,2,3)%]" type="checkbox" id="fftRandom1_response_2" class="HideElement" onclick="UpdateCost()">
<div id="fftRandom1_response_2_graphical" class="graphical_select checkbox"></div></td>

<td class="input_cell clickable alt_color1" width="22%" nowrap >
<input name="fftRandom1_response_3" value="[%CBCDesignLevelText (CBC01_random1,3,3)%]" type="checkbox" id="fftRandom1_response_3" class="HideElement" onclick="UpdateCost()">
<div id="fftRandom1_response_3_graphical" class="graphical_select checkbox"></div></td>

<td class="input_cell clickable alt_color2" width="22%" nowrap >
<input name="fftRandom1_response_4" value="1" type="checkbox" id="fftRandom1_response_4" class="HideElement" onchange="toggleActivation()">
<div id="fftRandom1_response_4_graphical" class="graphical_select checkbox"></div></td>

Both scripts work fine, if executed under HTML (normal website). However, if I use them under Sawtooth 7 they do not execute. Do you have any suggestions how to fix this problem?

Thank you very much for your help.

All the best,
asked Jan 1, 2012 by anonymous
edited Jan 1, 2012 by Walter Williams
can you give it a try by turning off the graphical checkboxes in study options? if it works then, it means this is related to the recent graphical checkboxes.

if this is the case, take a look at https://sawtoothsoftware.com/forum/501/graphical-chekbox to borrow some code from there :)
hi bahadir. i alteady tried that. unfortunstely it does not change anything. Tank you for your Content!

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.