Have an idea?

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

Show real-time calculation on Numeric question

I have a numeric question (how many times do you....per month) and my client would like me to show the yearly calculation at the same time (so if you enter 6 you can show 72 times per year.

I set up a span tag  but until you click out of the entry box of the numeric question it won't show.  A suggestions?

Here is what I'm using:
<script type="text/javascript">
function UpdateQ6 ()
    var myspan = document.getElementById("Q6span");
asked Aug 25, 2020 by Jay Rutherford Gold (43,925 points)
You're really close.  "onblur" triggers when an input element is left.  Try out "onkeyup" for an event that will trigger with each keystroke.
Ahhhh! Perfect!  Thanks for the course correction there Zach.  That works exactly as needed.

1 Answer

0 votes
Hi Jay,

Please use below to do this.

    var ab=SSI_GetValue("Q6")*12;
answered Aug 25, 2020 by Rahul Mittal Gold (11,635 points)
edited Aug 25, 2020 by Rahul Mittal
That doesn't seem to be working, so I'm probably not implementing it correctly.  My numeric question is Q6.  On that page I have:
 Annual # <span id="Q6span"></span>

I removed the scripting I had and put the script you provided in the footer but nothing shows up in the span tag.
Please check now, I have updated/edited my answer. Earlier mistaken in terminating the code.
Thanks so much Rahul!  That also works exactly as needed.  Now I have a couple of solutions for my bag of tricks to pull from.  Thanks for the solution.