Have an idea?

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

Suppress Price Adjustment Warning in ACBC BYO

I have an ACBC study where I'm using Summed Pricing. In order to apply level prices as percentage depending on another attribute I'm using the price adjustment functionality. Is there a possibility to suppress the price adjustment warnings popping up with every selection made in the BYO?
Or do you see another possibility to have level prices as percentage depending on another attribute instead of using price adjustments?
asked Sep 16 by ingo (410 points)

1 Answer

0 votes
 
Best answer
Please try adding this script to your BYO footer:

<script>
BYOObj_[% QuestionName() %].BYOPriceChangeAlert = function() {};
</script>
answered 6 days ago by Zachary Platinum Sawtooth Software, Inc. (151,250 points)
selected 6 days ago by ingo
Hi Zachary,
This works! Thank you very much. Purely out of interest: Why does it work if I put it into the footer, but not in Header2? In the style "Flex_Blue" an empty grey footer box is shown even when there is only script or CSS in the footer.
The reason for this is a matter of order of operations.  For example, try adding one of these to one page and the other to another page:

<input id="test"/>

<script>
$('#test').val('1');
</script>


<script>
$('#test').val('1');
</script>

<input id="test"/>


The page with the former script should successfully change the value of the input element to 1, but the latter script won't.  When the script runs before the input element exists, it can't find any input element whose value it is meant to change.  This is the same problem you are experiencing with header 2 vs footer: the custom script is running too early.

It's not super fun having to worry about the order of HTML and script elements on a page, so developers will often circumvent this by using what are called events to make their JavaScript wait a little while before running.  Here's an example of the previously-broken script now using document.ready, an event that fires after all the HTML has been read in:

<script>
$(document).ready(function(){
    $('#test').val('1');
})
</script>

<input id="test"/>


Now it works.

While we could write up some CSS to manually override the empty grey box you are observing, the more elegant solution would be to use this document.ready event with the custom code.
Hi Zachary,
Thank you very much for the explanations!
...