home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey_unconfigured / HiddenFieldList.asp < prev    next >
Text File  |  2006-10-25  |  11KB  |  273 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page allows a user to insert, delete, and modify 
  7. '                      hidden fields.
  8. '
  9. '   COPYRIGHT NOTICE                                
  10. '
  11. '   See attached Software License Agreement
  12. '
  13. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  14. '***********************************************************************
  15. %>
  16. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  17. <!--#Include File="Include/Utility_inc.asp"-->
  18. <!--#Include File="Include/Constants_inc.asp"-->
  19. <!--#Include File="Include/Config_inc.asp"-->
  20. <!--#Include File="Include/ID_inc.asp"-->
  21. <!--#Include File="Include/adovbs_inc.asp"-->
  22. <!--#Include File="Include/CurrentUser_inc.asp"-->
  23. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  24.  
  25. <html>
  26. <head>
  27.     <title>Hidden Fields</title>
  28.     <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  29. </head>
  30.  
  31. <%
  32.     Dim lngSurveyID
  33.     Dim strSurveyName
  34.     Dim rsHiddenFields
  35.     Dim strSQL
  36.     Dim flgHasHiddenFields
  37.     Dim conHiddenFields
  38.     Dim lngHiddenFieldID
  39.     Dim lngCurrentHiddenFieldNumber
  40.                 
  41.     'Initialization
  42.     Set rsHiddenFields = Server.CreateObject("ADODB.Recordset")
  43.     Set conHiddenFields = Server.CreateObject("ADODB.Connection")
  44.     conHiddenFields.Open SURVEY_APP_CONNECTION
  45.     lngCurrentHiddenFieldNumber = 1
  46.     If Len(Request.QueryString("SurveyID")) > 0 Then
  47.         lngSurveyID = Request.QueryString("SurveyID")
  48.         strSurveyName = Request.QueryString("SurveyName")
  49.     Else
  50.         lngSurveyID = Request.Form("SurveyID")
  51.         strSurveyName = Request.Form("SurveyName")
  52.     End If
  53. %>
  54.  
  55. <script language ="JavaScript" src="ClientInclude/Utility.js"></script>
  56. <script language="JavaScript">
  57. function deleteHiddenField(lngHiddenFieldID)
  58. {
  59.     if (validateAllHiddenFields(lngHiddenFieldID) == true)
  60.     {
  61.         if (confirm("Are you sure you want to delete this hidden field?") == true) //OK
  62.         {
  63.             document.forms['frmHiddenField'].ActionAfterSave.value = '<%=SUR_HIDDEN_FIELD_ACTION_DELETE%>';
  64.             document.forms['frmHiddenField'].HiddenFieldID.value = lngHiddenFieldID;
  65.             document.forms['frmHiddenField'].submit();
  66.         }
  67.     }
  68. }
  69.  
  70. function submitCheck()
  71. {
  72.     // Check to make sure that all hidden fields are valid before submitting the page
  73.     if (validateAllHiddenFields('-1') == true)
  74.     {
  75.         document.forms['frmHiddenField'].submit();
  76.     }
  77. }
  78.  
  79. function insertHiddenField()
  80. {
  81.     // Check to make sure that all hidden fields are valid before inserting a new hidden field the page
  82.     if (validateAllHiddenFields('-1') == true)
  83.     {
  84.         document.forms['frmHiddenField'].ActionAfterSave.value = '<%=SUR_HIDDEN_FIELD_ACTION_INSERT%>';
  85.         document.forms['frmHiddenField'].submit();
  86.     }
  87. }
  88.  
  89. function validateAllHiddenFields(lngHiddenFieldIDToBeDeleted)
  90. {
  91.     var strTemp;
  92.     var i;
  93.     
  94.     // Dynamically check the format of all number and date text boxes
  95.     if (document.forms['frmHiddenField'] != null) 
  96.     {
  97.         for (i = 0; i < document.forms['frmHiddenField'].length; i++) 
  98.         {
  99.             strTemp = document.forms['frmHiddenField'].elements[i].name;
  100.             if (strTemp.indexOf('txtHiddenFieldKey') > -1 && strTemp.indexOf(lngHiddenFieldIDToBeDeleted) == -1)
  101.             {
  102.                 strTemp = trim(document.forms['frmHiddenField'].elements[i].value);
  103.                 if (strTemp.length == 0)
  104.                 {
  105.                     alert("Please enter a value for the hidden field key.");
  106.                     document.forms['frmHiddenField'].elements[i].focus();
  107.                     return;
  108.                 }
  109.             }
  110.             else if (strTemp.indexOf('txtHiddenFieldDisplayName') > -1 && strTemp.indexOf(lngHiddenFieldIDToBeDeleted) == -1)
  111.             {
  112.                 strTemp = trim(document.forms['frmHiddenField'].elements[i].value);
  113.                 if (strTemp.length == 0)
  114.                 {
  115.                     alert("Please enter a value for the hidden field display name.");
  116.                     document.forms['frmHiddenField'].elements[i].focus();
  117.                     return;
  118.                 }
  119.             }
  120.         }
  121.     }
  122.     
  123.     return true;
  124. }
  125. </script>
  126.  
  127. <body class="MainBodyStyle">
  128.  
  129. <!--#Include File="Include/FrameworkTop_inc.asp"-->
  130.  
  131. <table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
  132.     <tr>
  133.         <td height="36" valign="center">
  134.               <span class="H1HeadingStyle"><a name="skipnav" tabindex="1">Hidden Fields</a></span> <img style="cursor:hand" alt="Help" onClick="javascript:window.open('Help/Help.htm#HiddenFields', null, 'menubar=no,toolbar=no,titlebar=no,status=no,left=10,top=10,scrollbars=yes,resizable=yes,height=550,width=770');" border="0" src="Resources/Images/Help.gif">
  135.         </td>
  136.     </tr>
  137. </table>
  138.  
  139. <!--#Include File="Include/FrameworkTop2_inc.asp"-->
  140.  
  141. <table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
  142.     <form method="post" name="frmHiddenField" onSubmit="return submitCheck();" action="HiddenFieldListAction.asp">
  143.         <input type="hidden" name="SurveyID" value="<%=lngSurveyID%>">
  144.         <input type="hidden" name="SurveyName" value="<%=strSurveyName%>">
  145.         <input type="hidden" name="ActionAfterSave" value="">
  146.         <input type="hidden" name="HiddenFieldID" value="">
  147.         <tr>
  148.             <td width="1"></td>
  149.             <td height="40" valign="center">
  150.                 <span class="H2HeadingStyle">Hidden Fields for '<%=strSurveyName%>' Survey</span>
  151.             </td>
  152.             <td width="1"> </td>
  153.         </tr>
  154.     </table>
  155.     <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="1" background="Resources/Images/ThinDivider.gif"></td></tr>
  156.     <table border="0" cellpadding="0" cellspacing="6" width="740" class="WhiteBackgroundColor">
  157.         <tr>
  158.             <td width="1" rowspan="25"></td>
  159.             <td width="710" height="70" valign="center">
  160.                 <span class="Normal">
  161.                     When a user responds to a survey, you may save data stored in session, cookies, or in the querystring, and have this 
  162.                     data be associated with each individual response. The Type field is the source of the hidden data, the 
  163.                     Key field is the key within the session, cookie, or querystring used to extract the data, and the Display Name field 
  164.                     is how the data captured will be displayed in the reports.
  165.                 </span>
  166.             </td>
  167.             <td width="1" rowspan="25"> </td>
  168.         </tr>
  169.         <tr>
  170.             <td valign="top">
  171.                 <table cellpadding="3" cellspacing="0" border="0" width="700" summary="This page displays a list of all hidden fields associated with the selected survey.">
  172.                     <tr class="TableHeadingColor" height="32">
  173.                         <th id="ID" width="50" align="center" valign="center">
  174.                             <span class="InlineHelpSpanStyleBold">#</span>
  175.                         </th>
  176.                         <th id="Delete" width="40" align="center" valign="center">
  177.                             <span class="InlineHelpSpanStyleBold">Delete</span>
  178.                         </th>
  179.                         <th id="Type" width="110" align="center" valign="center">
  180.                             <span class="InlineHelpSpanStyleBold">Type</span>
  181.                         </th>
  182.                         <th id="Key" width="250" align="center" valign="center">
  183.                             <span class="InlineHelpSpanStyleBold">Key</span>
  184.                         </th>
  185.                         <th id="DisplayName" width="250" align="center" valign="center">
  186.                             <span class="InlineHelpSpanStyleBold">Display Name</span>
  187.                         </th>
  188.                     </tr>
  189. <%                    
  190.                     'Get the existing hidden fields for this page
  191.                     strSQL = "SELECT hidden_field_id, hidden_field_type, hidden_field_key, hidden_field_display_name " & _
  192.                              "FROM sur_hidden_field " & _
  193.                              "WHERE survey_id = " & lngSurveyID & _
  194.                              " ORDER BY order_number"
  195.                     Set rsHiddenFields = conHiddenFields.Execute(ConvertSQL(strSQL), , adCmdText)
  196.  
  197.                     'If there are no existing hidden fields, display a message to that effect
  198.                     If rsHiddenFields.EOF = True Then
  199.                         flgHasHiddenFields = False
  200. %>
  201.                         <tr>
  202.                             <td colspan="5">
  203.                                 <span class="InlineHelpSpanStyle">There are no hidden fields for this survey.</span>
  204.                             </td>
  205.                         </tr>
  206. <%
  207.                     Else 'There are existing hidden fields
  208.                         flgHasHiddenFields = True
  209.                         rsHiddenFields.MoveFirst
  210.                         Do While Not rsHiddenFields.EOF
  211.                             lngHiddenFieldID = rsHiddenFields("hidden_field_id")
  212. %>
  213.                             <tr>
  214.                                 <td align="center" valign="center">
  215.                                     <span class="NormalBold"><label for="cboHiddenFieldType<%=lngHiddenFieldID%>"><%=lngCurrentHiddenFieldNumber%></label></span>
  216.                                 </td>
  217.                                 <td align="center" valign="bottom">
  218.                                     <a href="javascript:deleteHiddenField('<%=lngHiddenFieldID%>');"><img alt="Delete this hidden field" border="0" src="Resources/Buttons/DeleteSmall.gif" onMouseOver="this.style.cursor='hand'"></a>
  219.                                 </td>
  220.                                 <td align="center">
  221.                                     <select name="cboHiddenFieldType<%=lngHiddenFieldID%>" id="cboHiddenFieldType<%=lngHiddenFieldID%>" style="width:110px">
  222.                                         <option <% If rsHiddenFields("hidden_field_type") = SUR_HIDDEN_FIELD_TYPE_COOKIE Then Response.Write "selected" End If %> value="<%=SUR_HIDDEN_FIELD_TYPE_COOKIE%>"><%=SUR_HIDDEN_FIELD_TYPE_COOKIE%></option>
  223.                                         <option <% If rsHiddenFields("hidden_field_type") = SUR_HIDDEN_FIELD_TYPE_QUERYSTRING Then Response.Write "selected" End If %> value="<%=SUR_HIDDEN_FIELD_TYPE_QUERYSTRING%>"><%=SUR_HIDDEN_FIELD_TYPE_QUERYSTRING%></option>
  224.                                         <option <% If rsHiddenFields("hidden_field_type") = SUR_HIDDEN_FIELD_TYPE_SESSION Then Response.Write "selected" End If %> value="<%=SUR_HIDDEN_FIELD_TYPE_SESSION%>"><%=SUR_HIDDEN_FIELD_TYPE_SESSION%></option>
  225.                                     </select>
  226.                                 </td>
  227.                                 <td align="center">
  228.                                     <input type="text" value="<%=rsHiddenFields("hidden_field_key")%>" name="txtHiddenFieldKey<%=lngHiddenFieldID%>" id="txtHiddenFieldKey<%=lngHiddenFieldID%>" style="width:215px">
  229.                                 </td>
  230.                                 <td align="center">
  231.                                     <input type="text" value="<%=rsHiddenFields("hidden_field_display_name")%>" name="txtHiddenFieldDisplayName<%=lngHiddenFieldID%>" id="txtHiddenFieldDisplayName<%=lngHiddenFieldID%>" style="width:215px">
  232.                                 </td>
  233.                             </tr>
  234. <%                        
  235.                             lngCurrentHiddenFieldNumber = lngCurrentHiddenFieldNumber + 1
  236.                             rsHiddenFields.MoveNext
  237.                         Loop                
  238.                     End If
  239. %>
  240.                 </table>
  241. <%
  242.                 'Clean up
  243.                 rsHiddenFields.Close
  244.                 Set rsHiddenFields = Nothing
  245. %>        
  246.             </td>
  247.         </tr>
  248.         <tr>
  249.             <td align="right" height="38" valign="center">
  250.                 <a href="Survey.asp?SurveyID=<%=lngSurveyID%>"><img border="0" alt="Return to the survey options page" name="btnBack" src="Resources/Buttons/Back.gif"></a>
  251.                 <a href="javascript:insertHiddenField();"><img border="0" alt="Insert a new hidden field" name="btnInsertHiddenField" src="Resources/Buttons/insertHiddenField.gif"></a>
  252. <%
  253.                 If flgHasHiddenFields = True Then
  254. %>
  255.                     <a href="javascript:submitCheck();"><img border="0" alt="Save all hidden fields" name="btnSave" src="Resources/Buttons/Save.gif"></a>
  256. <%                
  257.                 End If
  258. %>            
  259.             </td>
  260.         </tr>
  261.     </form>
  262. </table>
  263.  
  264. <!--#Include File="Include/FrameworkBottom_inc.asp"-->
  265.  
  266. </body>
  267. </html>
  268.  
  269. <%        
  270.     'Ensure that the web server returns the page
  271.     Response.Flush
  272. %>
  273.