(I chose to start a new topic here since I don't know if the ones in the old forum are still being answered or if the respondents are being reported of new comments)
Based on this famous thread (
https://www.sawtoothsoftware.com/forum.php?cmd=show&thread=1608&posts=3 ), I'm using a slider on my survey. What I want to do is to store the last value the user chooses in the slider, before clicking the "next" button, or simply put, his final answer to that question. Though, I can't output the slider's value every time the user clicks in it, for debugging purposes.
<input name="PerguntaVAS1_v1" id="PerguntaVAS1_v1" type="hidden" onchange="s.setValue(parseInt(this.value))">
<!-- HTML to use for the slider //-->
<p><div class="slider" id="slider-1" tabIndex="1">
<input class="slider-input" id="slider-input-1"/>
</div>
<!-- JavaScript object that handles the logic //-->
<script type="text/javascript">
var s = new Slider(document.getElementById("slider-1"), document.getElementById("slider-input-1"));
s.setValue(0);
s.onchange = function ()
{
document.getElementById("PerguntaVAS1_v1").value = s.getValue();
document.getElementById("h-min").value = s.getMinimum();
document.getElementById("h-max").value = s.getMaximum();
//document.write(SSI_GetValue("PerguntaVAS1_v1"));
alert("My value at this point is: " + SSI_GetValue("PerguntaVAS1_v1"));
};
s.setValue(0);
window.onresize = function () {
s.recalculate();
};
alert("My value at this point is: " + SSI_GetValue("PerguntaVAS1_v1"));
</script>
I do know the value is stored in "PerguntaVAS1_var1", but I could only get to output it in the beginning, and I thought that outputting it inside the "onchange" function would get me to do what I want, still nothing appears, I must be doing something weird. Anyone has a suggestion?
Thanks,
João