Changeset 18 for Dev


Ignore:
Timestamp:
07/15/11 21:15:37 (14 years ago)
Author:
fpvanagthoven
Message:

Added integer.

Location:
Dev/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/SurveyCreationTool.php

    r17 r18  
    2828        <script type="text/javascript">
    2929            var questionCount = 1;           
    30                                                                            
     30                                                                                   
    3131            function getNewQuestion()
    3232            {
     
    4343                    "<td><select id='" + questionCount + "' name='questionType" + questionCount + "' onchange='handleType(this)'><br />"+
    4444                    "<option value='text' selected='selected'>Text</option>" +
    45                     "<option value='multipleChoice'>Multiple choice</option>" +
     45                    "<option value='int'>Integer</option>" +
     46                    "<option value='mc'>Multiple choice</option>" +
    4647                    "<option value='checkboxes'>Checkboxes</option>" +
    4748                    "<option value='scale'>Scale</option>" +
    48                     "<option value='grid'>Grid</option>" +
    4949                    "</select></td></tr>" +
    5050                    "</table>" +
    5151                    "<div id='answersDiv" + questionCount + "'></div>" +
    5252                    "</div>";
    53                                                                        
     53                                                                               
    5454                questionDiv.innerHTML = htmlStr;
    55                                                                        
     55                                                                               
    5656                return questionDiv;
    5757            }
    58                                                                            
     58                                                                                   
    5959            function handleFocus(input)
    6060            {
     
    6666                }
    6767            }
    68                                                                                                            
     68                                                                                                                   
    6969            function handleBlur(input)
    7070            {       
    7171                var surveyTitle = document.getElementById('surveyTitle');
    7272                var surveyDescription = document.getElementById('surveyDescription');
    73                                                                                            
     73                                                                                                   
    7474                if (input.value == "")
    7575                {
    7676                    input.style.color = "gray";
    7777                    input.clicked = null;
    78                                                                                                                    
     78                                                                                                                           
    7979                    if (input == surveyTitle)
    8080                    {
     
    8787                }                           
    8888            }
    89                                                            
     89                                                                   
    9090            function handleType(select)
    9191            {
     
    9494                answersDiv.answerCount = 1;
    9595                answersDiv.clicked = null;
    96                
     96                       
    9797                switch (type) {
    98                     case 'multipleChoice':
     98                    case 'mc':
    9999                        answersDiv.innerHTML = "";
    100100                        addOption(select.id);
    101                                                
     101                                                       
    102102                        break;
    103103                    case 'text':
    104104                        answersDiv.innerHTML = "";
    105                        
     105                        break;
     106                    case 'int':   
     107                        answersDiv.innerHTML = "";
     108                        //min max
     109                        minMax(select.id);
    106110                        break;
    107111                    case 'checkboxes':
    108                         answersDiv.innerHTML = "";                                               
     112                        answersDiv.innerHTML = ""; 
     113                        addOption(select.id);
    109114                        break;
    110115                    case 'scale':
    111                         answersDiv.innerHTML = "";                                               
    112                         break;
    113                     case 'grid':
    114                         answersDiv.innerHTML = "";                                               
     116                        answersDiv.innerHTML = "";
     117                        //what scale (min max incr)
    115118                        break;
    116119                    default:
     
    119122
    120123            }
     124                                                   
    121125                                           
    122                                    
    123126            function addOption(questionNumber)
    124127            {       
     
    127130                var answerDiv = document.createElement("div");
    128131                answerDiv.className = "answerDiv";
    129                                        
     132                                               
    130133                var htmlStr = "<input type='text' name='q" +
    131134                    questionNumber + "ans" + answerCount + "' value='Option " + answerCount + "' />";
    132                
     135                       
    133136                if (answersDiv.clicked == null)
    134137                {
     
    137140                    answersDiv.clicked = true;
    138141                }
    139                                                
     142                                                      
    140143                answerDiv.innerHTML = htmlStr;
    141                                                
     144                                                      
    142145                answersDiv.appendChild(answerDiv);
    143146                answersDiv.answerCount++;
    144147            }
    145                                            
    146                                                          
     148           
     149            function minMax(questionNumber)
     150            {
     151               var answersDiv = document.getElementById("answersDiv" + questionNumber);
     152               
     153               var answerDiv = document.createElement("div");
     154               answerDiv.className = "answerDiv";
     155               answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' name='min" + questionNumber + "' />" +
     156               "<label for='max'>Max</label><input type='text' name='max" + questionNumber + "' />";
     157           
     158                answersDiv.appendChild(answerDiv);
     159            }           
     160                                                                 
    147161            function addQuestion()
    148162            {
    149163                var questionsDiv = document.getElementById('questionsDiv');
    150164                var newQuestion = getNewQuestion();
    151                                                                        
     165                                                                               
    152166                questionsDiv.appendChild(newQuestion);
    153167                questionCount++;
    154168            }
    155                                                                                                                                                                                    
     169           
     170                                                                                                                                                                                           
    156171        </script>
    157172        <?php
  • Dev/trunk/surveys

    • Property svn:ignore set to
      .rdf
Note: See TracChangeset for help on using the changeset viewer.