0

前の質問への回答を表示するために、自分のフォームの質問が必要です。質問のロジックや Go To 機能について質問しているわけではありません。例えば:

Q1: 前菜は何にしますか?肉 魚 ベジタリアン

Q2:好きな料理は?インド系アメリカ人メキシコ人

改ページ。

Q3: 前の質問で、[Q2] [Q1] の前菜を選択しました。

Q1 への回答が肉で、Q2 への回答がインドの場合、Q3 は次のように表示されます。

前の質問では、インドの肉のメインディッシュを選択しました。

これは、SurveyMonkey で可能です (角括弧を使用)。これは Google フォームで実行できますか?

4

1 に答える 1

0

ボスの時間に汚いコードを書いてしまった

これはサーバー側とクライアント側のスクリプトが混在しているため、関数 q1H & q2H で質問 Q3 を作成できたはずです。

 var q1A = new Array(" Meat", " Fish", " Vegetarian")
 var q2A = new Array(" Indian" ," American", " Mexican")

function doGet(e) {
var app = UiApp.createApplication().setTitle("Dev Test Sitemap");
var mainPanel = app.createVerticalPanel()
var homePanel = app.createHorizontalPanel()

 var q1 = app.createLabel("Q1 What type of entree would you like?")
 var q1ListBox = app.createListBox().setName("q1ListBox") ;
  for (var i = 0; i < q1A.length; i++) {
    q1ListBox.addItem(q1A[i]);
  }

  var handlerQ1 = app.createServerHandler("q1H");
  q1ListBox.addChangeHandler(handlerQ1)

  mainPanel.add(q1);
 mainPanel.add(q1ListBox);

  var q2 = app.createLabel("Q2 Indian American Mexican?")
  var q2ListBox = app.createListBox().setName("q2ListBox") ;
  for (var i = 0; i < q2A.length; i++) {
     q2ListBox.addItem(q2A[i]);
   }

   var handlerQ2 = app.createServerHandler("q2H");
   q2ListBox.addChangeHandler(handlerQ2)

   mainPanel.add(q2);
   mainPanel.add(q2ListBox);


   mainPanel.add(app.createLabel("----------------------------------- pagebreak ---------------------") );

  var horP = app.createHorizontalPanel()
  //Q3: In the previous questions, you selected an [Q2] [Q1] entree.
  var  q3 = app.createLabel("In the previous questions, you selected an")
  horP.add(q3)

  var q2ans =new Array() 
  for (var i = 0; i < q2A.length; i++) {
     q2ans[i] = app.createLabel(q2A[i]).setId("q2A"+[i]).setVisible(false);
     horP.add(q2ans[i])

  }
   var q1ans =new Array() ;
   for (var i = 0; i < q1A.length; i++) {
     q1ans[i] = app.createLabel(q1A[i]).setId("q1A"+[i]).setVisible(false);
     horP.add(q1ans[i])
   }

   var  q32 = app.createLabel(" entree")
   horP.add(q32)

   mainPanel.add(horP);

   app.add(mainPanel);  //red
  return app.close();
 } 


 function q1H(e) {
   var app = UiApp.getActiveApplication();
   var q1ListBox =   e.parameter.q1ListBox;



   for (var i = 0; i < q1A.length; i++) {
     if (q1ListBox == q1A[i] ){
       app.getElementById("q1A"+[i]).setVisible(true);
    }

  }

    return app;
  }

  function q2H(e) {
   var app = UiApp.getActiveApplication();
   var q2ListBox =   e.parameter.q2ListBox;

    for (var i = 0; i < q2A.length; i++) {
     if (q2ListBox == q2A[i] ){
      app.getElementById("q2A"+[i]).setVisible(true);
     }

     }

  return app;
  }

実施例

于 2013-02-08T19:24:01.290 に答える