Have an idea?

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

Screen width capture in v7

I know this concept / script Justin Luster kindly provided works in v9 ...

1) Create a Free Format question named "screen".
2) Create a variable named "width" and make sure it is of type "hidden" and also set to "whole number".
3) Enter this HTML for the question:
 <input name="screen_width" id="screen_width" type="hidden" value="">


I was testing in v7 and when testing, the free format variable is blank.

Do you have a solution to have it working in v7?
asked May 5, 2017 by Paul Moon Platinum (98,670 points)

1 Answer

0 votes
Try this jQuery-less code:

document.getElementById('screen_width').value = document.documentElement.clientWidth;
answered May 5, 2017 by Zachary Platinum Sawtooth Software, Inc. (206,100 points)
Thanks Zachary. I will give it a test drive in the morning. After 3am Saturday in Australia. Still at it! Busy week.
Hi Zachary, I got the same result when testing your script in v7.

I inserted your script into the free format question and when testing, the screen_width variable was blank?

I can send the ssi file to you. Is there something I've missed?

As mentioned earlier, I had Justin's working nicely in v9.

When using Justin's and your script in v7, the screen_width variable was always blank.