Have an idea?

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

Execute a page/question, but hide the page from the user

The first page asks for a selection (on Q1), in which levels are defined in detail.

Q1_level1: This is the description for level 1.
Q1_level2: This is the description for level 2.
Q1_level3: This is the description for level 3.

During the choice task, I'd like the concise version of those levels to be displayed.

e.g., [no detailed descriptions are shown; these are constructed from selected levels]
Let's call this set ConstructedQ1.

I'd like ConstructedQ1 levels to be displayed in the choice task.

The second page is meant to be hidden, where the selection from Q1 is carried over to ConstructedQ1.

e.g., The value for Q1 is level 1. I'd like the radio button for level 1 of ConstructedQ1 to be filled in, so that ConstructedQ1_lvl1 is displayed in the choice task.

So far, I can get that behaviour with the following:
 <script type="text/javascript">
   if ([% Q1 %] == 1) {
       SSI_SetSelect('ConstructedQ1Hide_1', true);
   if ([% Q1%] == 2) {
       SSI_SetSelect('ConstructedQ1Hide_2', true);

However, I don't know how to have it executed without having the user see it. I take it that skip logic wouldn't work because this page would need to be evaluated. So, I'd like to have the page hidden.
asked Jul 24, 2019 by yorkmr (450 points)
edited Jul 24, 2019 by yorkmr
I was able to hide the question but not the full page with this...
#Q2Hide_div {display:none}

Basically, I can see the back and next buttons still.
You are correct that pre-skips run on the server, long before any JavaScript could have a chance to run.

Could you expound a bit more on what you're end goal is?  How do you plan to use the response to Q1Hide, Q2Hide, etc in the survey?  Is this all to hide the description portion of some list items on certain pages?
Sorry,  I've edited the original post to show "ConstructedQ1Hide" instead of Q1Hide and Q2Hide (typos).

ConstructedQ1Hide is the question that I'd like to hide. With the code in the original post, ConstructedQ1Hide should be autopopulated (radio button filled in, and therefore, "a response is provided"), based off of the obtained value of Q1.

If level 1 of Q1 was chosen and sent off to the choice task, then the more lengthy text ( "Q1_level1: This is the description for level 1.")  would be shown in the choice task. I don't want users to see that much text.

ConstructedQ1Hide should take on the value of "ConstructedQ1_lvl1", because it is shorter in text length. I'd like that to be shown in the choice task.

Essentially, I want ConstructedQ1Hide to be autopopulated, executed, and carried over to the choice task, such that its less lengthy text (compared to Q1's level) is shown (they correspond to each other; it's just that one is wordy, one is concise).

And the reason for why I'm setting this up as a separate question is because of the BYO code that I use later on (for ACBC).

In the BYO , we are autopopulating the user's earlier, stated preference (e.g., Q1, and by autopopulation, ConstructedQ1Hide).

if (!SSI_GetValue('env_BYO_2')) {
    SSI_SetSelect('env_BYO_2_[% Q1%]', true);

Because Q1s levels are text-heavy, I'd like to pull in the less lengthy level, ConstructedQ1Hide.

if (!SSI_GetValue('env_BYO_2')) {
    SSI_SetSelect('env_BYO_2_[% ConstructedQ1Hide%]', true);

hope that made sense! Perhaps there was a simpler way??

1 Answer

0 votes
Ah! So this code did work -- I just needed to delete the page break to remove the Back and Next button!
#Q2Hide_div {display:none}

Expected behaviour works : 1) concise version of the levels is constructed from the original levels, 2) concise version gets passed on by having the 2nd page executed but hidden from view.
answered Jul 25, 2019 by yorkmr (450 points)