'If the user clicked the Update button to change the number of answers, the value answered must be numeric
If CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Then
%>
function insertNewAnswer()
{
var lngAnswerCount = Number(document.forms['frmItemType'].AnswerCount.value);
'If the item has responses, the only three fields that are displayed are the item text, the question alias, and
'the item sub-text. Of these, the only field that must contain a value is the item text. This page has two functions
'named submitCheck(), which could have been combined into a single function, in order to make the code easier
'to read and maintain.
If flgHasResponses = True Then
%>
function validateForm()
{
flgReturnValue = true;
<%
'If the item type has an initial question/message prompt, make sure that a value has been supplied
If CLng(lngComboItemTypeID) = SUR_ITEM_DATABASE_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_HEADING Or CLng(lngComboItemTypeID) = SUR_ITEM_MESSAGE Or CLng(lngComboItemTypeID) = SUR_ITEM_HTML Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_LINE Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_COMMENTS_BOX Or CLng(lngComboItemTypeID) = SUR_ITEM_DATE Or CLng(lngComboItemTypeID) = SUR_ITEM_NUMBER Or CLng(lngComboItemTypeID) = SUR_ITEM_YES_NO Or CLng(lngComboItemTypeID) = SUR_ITEM_TRUE_FALSE Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_RATING_SCALE Or CLng(lngComboItemTypeID) = SUR_ITEM_CONSTANT_SUM Or CLng(lngComboItemTypeID) = SUR_ITEM_RANKING Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
%>
if (flgReturnValue == true && trim(document.forms['frmItemType'].txtItemText.value) == "")
'If the item type has an initial question/message prompt, make sure that a value has been supplied
If CLng(lngComboItemTypeID) = SUR_ITEM_DATABASE_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_HEADING Or CLng(lngComboItemTypeID) = SUR_ITEM_MESSAGE Or CLng(lngComboItemTypeID) = SUR_ITEM_HTML Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_LINE Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_COMMENTS_BOX Or CLng(lngComboItemTypeID) = SUR_ITEM_DATE Or CLng(lngComboItemTypeID) = SUR_ITEM_NUMBER Or CLng(lngComboItemTypeID) = SUR_ITEM_YES_NO Or CLng(lngComboItemTypeID) = SUR_ITEM_TRUE_FALSE Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_RATING_SCALE Or CLng(lngComboItemTypeID) = SUR_ITEM_CONSTANT_SUM Or CLng(lngComboItemTypeID) = SUR_ITEM_RANKING Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
%>
if (flgReturnValue == true && trim(document.forms['frmItemType'].txtItemText.value) == "")
'If this is a question that has row text (constant sum, ranking, open-ended one or more lines, or matrix,
'make sure that if the row text width is entered, it's numeric
If CLng(lngComboItemTypeID) = SUR_ITEM_CONSTANT_SUM Or CLng(lngComboItemTypeID) = SUR_ITEM_RANKING Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Or IsMatrixQuestion(lngComboItemTypeID) = True Then
%>
if (flgReturnValue == true && trim(document.forms['frmItemType'].txtRowTextWidth.value) != '')
{
if (isNumeric(trim(document.forms['frmItemType'].txtRowTextWidth.value)) == false)
{
alert("The row heading width field must contain a numeric value.");
'If this is a question with subitems, make sure that at least one subitem was entered.
If CLng(lngComboItemTypeID) = SUR_ITEM_CONSTANT_SUM Or CLng(lngComboItemTypeID) = SUR_ITEM_RANKING Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_RATING_SCALE Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
%>
// Check the list of subitems. Split on the line feed, creating an array of distinct subitem records.
var arrSubitems;
var i;
var flgSubitemEntered = false;
var strSubitems = document.forms['frmItemType'].txtRowNames.value;
arrSubitems = strSubitems.split('\n');
// Loop through each of the subitems
for (i = 0; i < arrSubitems.length; i++)
{
// If the line has nothing but an Enter key on it, ignore it
if (arrSubitems[i] != '\r' && trim(arrSubitems[i]) != "")
{
flgSubitemEntered = true;
}
}
// If no subitems were entered (every row is blank), display an error message
if (flgReturnValue == true && flgSubitemEntered == false)
{
alert("Please enter at least one valid row name.");
'Make sure that the user enters at least one answer
If CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Or CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Then
%>
if (flgReturnValue == true && trim(document.forms['frmItemType'].txtAnswer1.value) == "")
{
alert("Please enter at least one answer, starting with the first answer text box.");
document.forms['frmItemType'].txtAnswer1.focus();
flgReturnValue = false;
}
<%
End If
'For option buttons, checkboxes, and dropdowns, make sure that only numeric values are entered for the points
If CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Then
%>
if (document.forms['frmItemType'] != null)
{
for (i = 0; i < document.forms['frmItemType'].length; i++)
'Make sure that the user enters at least one column heading
If CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Then
%>
if (flgReturnValue == true && trim(document.forms['frmItemType'].txtAnswer1.value) == "")
{
alert("Please enter at least column heading, starting with the first column heading text box.");
'Only display the link for copy an existing item in INSERT mode.
If strState = SUR_STATE_INSERT Or strState = SUR_STATE_INSERT_REFRESH Then
%>
<span class="Normal">or</span>
<%
Else
Response.Write " "
End If
%>
</td>
<td width="100" valign="bottom">
<%
'Only display the link for copy an existing item in INSERT mode.
If strState = SUR_STATE_INSERT Or strState = SUR_STATE_INSERT_REFRESH Then
%>
<a href="javascript:copyExistingItem();"><img border="0" alt="Copy an existing item" src="Resources/Buttons/CopyExistingItemSmall.gif"></a>
<%
Else
Response.Write " "
End If
%>
</td>
<td width="40" align="middle" valign="top">
<%
'Only display the link for inserting an item from a library in INSERT mode when NOT coming from a library.
If (strState = SUR_STATE_INSERT Or strState = SUR_STATE_INSERT_REFRESH) And Len(lngLibraryID) = 0 Then
%>
<span class="Normal">or</span>
<%
Else
Response.Write " "
End If
%>
</td>
<td width="140" valign="bottom">
<%
'Only display the link for inserting an item from a library in INSERT mode when NOT coming from a library.
If (strState = SUR_STATE_INSERT Or strState = SUR_STATE_INSERT_REFRESH) And Len(lngLibraryID) = 0 Then
%>
<a href="javascript:insertFromLibrary();"><img border="0" alt="Insert an item from a library" src="Resources/Buttons/InsertFromLibrarySmall.gif"></a>
<%
Else
Response.Write " "
End If
%>
</td>
</tr>
</table>
</td>
</tr>
<%
'If the control type is an image, display a file input control
If CLng(lngComboItemTypeID) = SUR_ITEM_IMAGE Then
%>
<tr>
<td valign="top">
<span class="QuestionSectionHeadingSpanStyle">
<label for="txtImagePath">Enter the Image Path</label>
</span>
<br>
<span class="InlineHelpSpanStyle">
<span class="InlineHelpSpanStyleBold">Enter the path to the image.</span><span class="Required">*</span> Use a full HTTP path, a relative path, or a path using a virtual directory.<br>
'If the control type is a horizontal rule <hr>, display a comment an example
ElseIf CLng(lngComboItemTypeID) = SUR_ITEM_HORIZONTAL_RULE Then
%>
<tr>
<td valign="top">
<span class="QuestionSectionHeadingSpanStyle">
Insert a Horizontal Rule
</span>
<br>
<span class="InlineHelpSpanStyle">
This item inserts an HTML horizontal rule element, as shown in the example below.
</span>
</td>
</tr>
<tr>
<td valign="top">
<span class="QuestionSectionHeadingSpanStyle">
<br>Example:<br>
</span>
<hr>
</td>
</tr>
<%
End If
'If the control type requires a question-type input, display the large text area prompt at the
'beginning of the page
If DisplayControl(SUR_CONTROL_QUESTION, lngComboItemTypeID) = True Then
%>
<tr>
<td height="32" valign="bottom">
<span class="QuestionSectionHeadingSpanStyle">
<%
'Display different text for the initial prompt depending on the item type
Select Case CLng(lngComboItemTypeID)
Case SUR_ITEM_MESSAGE:
%>
Message
<%
Case SUR_ITEM_HEADING:
%>
Heading
<%
Case SUR_ITEM_HTML:
%>
HTML
<%
Case Else:
%>
Question
<%
End Select
%>
</span>
</td>
</tr>
<tr>
<td>
<%
'Display different sub-text for the initial prompt depending on the item type
Select Case CLng(lngComboItemTypeID)
Case SUR_ITEM_MESSAGE:
lngRows = 6
%>
<span class="InlineHelpSpanStyleBold"><label for="txtItemText">Enter the message.</label></span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Enter the text for the message.<br></span>
<%
Case SUR_ITEM_HEADING:
lngRows = 2
%>
<span class="InlineHelpSpanStyleBold"><label for="txtItemText">Enter the heading.</label></span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Enter the text for the heading.<br></span>
<%
Case SUR_ITEM_HTML:
lngRows = 10
%>
<span class="InlineHelpSpanStyleBold"><label for="txtItemText">Enter the HTML.</label></span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Use this field to enter any HTML and/or content. Text will be displayed using the HTML tags you enter.<br></span>
<%
Case Else:
lngRows = 2
%>
<span class="InlineHelpSpanStyleBold"><label for="txtItemText">Enter the question.</label></span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Use this field to enter the text for your question or input prompt.<br></span>
If CLng(lngComboItemTypeID) <> SUR_ITEM_HEADING And CLng(lngComboItemTypeID) <> SUR_ITEM_HTML And CLng(lngComboItemTypeID) <> SUR_ITEM_MESSAGE Then
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtItemAlias">Enter the question alias.</label></span> Enter alternate text for use in the reports. If blank, the actual question will be displayed.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtItemSubText">Enter the sub-text.</label></span> Enter informational or additional text to display below the question.</span>
If CLng(lngComboItemTypeID) = SUR_ITEM_DATABASE_DROPDOWN Then
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDatabaseSQL">Enter the SQL.</label></span><span class="Required">*</span> The SQL must contain two columns aliased as ItemValue and ItemDisplay.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDatabaseDSN">Enter the connection string.</label></span><span class="Required">*</span> Enter the DSN or connection string to connect to the database for this query.<br></span>
If DisplayControl(SUR_CONTROL_REQUIRED, lngComboItemTypeID) = True Then
%>
<tr>
<td valign="top">
<input type="checkbox" <% If strRequiredYesNo = SUR_BOOLEAN_POSITIVE Then Response.Write "checked " End If %> name="chkRequired" id="chkRequired">
<span class="InlineHelpSpanStyleBold">Required.</span> <span class="InlineHelpSpanStyle">Check this box if an answer to this question is required.</span>
</td>
</tr>
<%
End If
If DisplayControl(SUR_CONTROL_RANDOM_ORDER, lngComboItemTypeID) = True Then
%>
<tr>
<td valign="top">
<input type="checkbox" <% If strRandomOrderYesNo = SUR_BOOLEAN_POSITIVE Then Response.Write "checked " End If %> name="chkRandomOrder" id="chkRandomOrder">
<span class="InlineHelpSpanStyleBold">Random Order.</span> <span class="InlineHelpSpanStyle">Check this box if the answers to this question should be displayed in random order.</span>
</td>
</tr>
<%
End If
'Display different types of input controls for other options depending on the question type
Select Case CLng(lngComboItemTypeID)
Case SUR_ITEM_OPEN_ENDED_ONE_LINE:
%>
<tr>
<td valign="top">
<input type="checkbox" <% If strEmailAddressYesNo = SUR_BOOLEAN_POSITIVE Then Response.Write "checked " End If %> name="chkEmailAddress" id="chkEmailAddress">
<span class="InlineHelpSpanStyleBold">Email address.</span> <span class="InlineHelpSpanStyle">Check this box if the answer to this question must be a valid email address.</span>
</td>
</tr>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDatabaseDSN">Default value.</label></span> The value entered below will be displayed as the default for this question.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDisplayType">Answer alignment.</label></span><span class="Required">*</span> Select the way answers should be aligned on the page.<br></span>
<option <% If strDisplayFormat = SUR_ANSWER_ALIGNMENT_HORIZONTAL Then Response.Write "SELECTED" End If %> value="<%=SUR_ANSWER_ALIGNMENT_HORIZONTAL%>"><%=SUR_ANSWER_ALIGNMENT_HORIZONTAL%></option>
<option <% If strDisplayFormat = SUR_ANSWER_ALIGNMENT_VERTICAL Then Response.Write "SELECTED" End If %> value="<%=SUR_ANSWER_ALIGNMENT_VERTICAL%>"><%=SUR_ANSWER_ALIGNMENT_VERTICAL%></option>
</select>
</td>
</tr>
<%
Case SUR_ITEM_CONSTANT_SUM
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDatabaseDSN">Answer total.</label></span> Enter the total that the value must add up to. To allow any total, leave this field blank.<br></span>
Case SUR_ITEM_MULTISELECT_CHECKBOXES, SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES:
'The alignment option should only be displayed for checkboxes
If CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Then
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDisplayType">Answer alignment.</label></span><span class="Required">*</span> Select the way answers should be aligned on the page.<br></span>
<option <% If strDisplayFormat = SUR_ANSWER_ALIGNMENT_VERTICAL Then Response.Write "SELECTED" End If %> value="<%=SUR_ANSWER_ALIGNMENT_VERTICAL%>"><%=SUR_ANSWER_ALIGNMENT_VERTICAL%></option>
<option <% If strDisplayFormat = SUR_ANSWER_ALIGNMENT_HORIZONTAL Then Response.Write "SELECTED" End If %> value="<%=SUR_ANSWER_ALIGNMENT_HORIZONTAL%>"><%=SUR_ANSWER_ALIGNMENT_HORIZONTAL%></option>
</select>
</td>
</tr>
<%
End If
%>
<tr>
<td valign="top">
<%
'The prompt displayed varies depending on the question type
If CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Then
%>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMinimumNumberResponses">Minimum number of responses.</label></span> Enter the minimum number of checkboxes that must be checked.<br></span>
<%
Else 'Must be open ended with one or more lines
%>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMinimumNumberResponses">Minimum number of responses.</label></span> Enter the minimum number of responses that must be entered.<br></span>
'The prompt displayed varies depending on the question type
If CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Then
%>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMaximumNumberResponses">Maximum number of responses.</label></span> Enter the maximum number of checkboxes that can be checked.<br></span>
<%
Else 'Must be open ended with one or more lines
%>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMaximumNumberResponses">Maximum number of responses.</label></span> Enter the maximum number of responses that must be entered.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtImageHeight">Image height.</label></span> To change the height of the image, enter a value below.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtImageWidth">Image width.</label></span> To change the width of the image, enter a value below.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboImageAlignment">Image alignment.</label></span> Select the horizontal alignment for how the image should be displayed.<br></span>
<option <% If strImageAlignment = SUR_IMAGE_ALIGNMENT_DEFAULT Then Response.Write "SELECTED" End If %> value="<%=SUR_IMAGE_ALIGNMENT_DEFAULT%>"><%=SUR_IMAGE_ALIGNMENT_DEFAULT%></option>
<option <% If strImageAlignment = SUR_IMAGE_ALIGNMENT_LEFT Then Response.Write "SELECTED" End If %> value="<%=SUR_IMAGE_ALIGNMENT_LEFT%>"><%=SUR_IMAGE_ALIGNMENT_LEFT%></option>
<option <% If strImageAlignment = SUR_IMAGE_ALIGNMENT_CENTER Then Response.Write "SELECTED" End If %> value="<%=SUR_IMAGE_ALIGNMENT_CENTER%>"><%=SUR_IMAGE_ALIGNMENT_CENTER%></option>
<option <% If strImageAlignment = SUR_IMAGE_ALIGNMENT_RIGHT Then Response.Write "SELECTED" End If %> value="<%=SUR_IMAGE_ALIGNMENT_RIGHT%>"><%=SUR_IMAGE_ALIGNMENT_RIGHT%></option>
</select>
</td>
</tr>
<%
Case SUR_ITEM_DATE:
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDefaultValue">Default value.</label></span> The date entered below will be the default value. Format for the date is <%=DisplayInternationalizedDateFormat%>.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMinimumValue">Minimum value.</label></span> Enter the earliest acceptable date. Format for the date is <%=DisplayInternationalizedDateFormat%>.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMaximumValue">Maximum value.</label></span> Enter the latest acceptable date. Format for the date is <%=DisplayInternationalizedDateFormat%>.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDefaultValue">Default value.</label></span> The value entered below will be displayed as the default for this question.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMaximumValue">Maximum value.</label></span> Enter the largest acceptable numeric value.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMinimumValue">Beginning number.</label></span> Enter the first number for the rating scale.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><lable for="txtMaximumValue">Ending number.</label></span> Enter the last number for the rating scale.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtDefaultValue">Default value.</label></span> The value entered below will be displayed as the default for this question.<br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDefaultValue">Default value.</label></span> This value will be selected as the default for this question.<br></span>
<option <% If strDefaultValue = SUR_COMBO_NONE Then Response.Write "SELECTED" End If %> value="<%=SUR_COMBO_NONE%>"><%=SUR_COMBO_NONE%></option>
<option <% If strDefaultValue = SUR_YES_NO_QUESTION_VALUE_YES Then Response.Write "SELECTED" End If %> value="<%=SUR_YES_NO_QUESTION_VALUE_YES%>"><%=SUR_YES_NO_QUESTION_VALUE_YES%></option>
<option <% If strDefaultValue = SUR_YES_NO_QUESTION_VALUE_NO Then Response.Write "SELECTED" End If %> value="<%=SUR_YES_NO_QUESTION_VALUE_NO%>"><%=SUR_YES_NO_QUESTION_VALUE_NO%></option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDisplayType">Display type.</label></span><span class="Required">*</span> Select the format for the response to the Yes/No question.<br></span>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_1 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_1%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_1%></option>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_2 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_2%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_2%></option>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_3 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_3%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_3%></option>
</select>
</td>
</tr>
<%
Case SUR_ITEM_TRUE_FALSE:
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDefaultValue">Default value.</label></span> This value will be selected as the default for this question.<br></span>
<option <% If strDefaultValue = SUR_COMBO_NONE Then Response.Write "SELECTED" End If %> value="<%=SUR_COMBO_NONE%>"><%=SUR_COMBO_NONE%></option>
<option <% If strDefaultValue = SUR_TRUE_FALSE_QUESTION_VALUE_TRUE Then Response.Write "SELECTED" End If %> value="<%=SUR_TRUE_FALSE_QUESTION_VALUE_TRUE%>"><%=SUR_TRUE_FALSE_QUESTION_VALUE_TRUE%></option>
<option <% If strDefaultValue = SUR_TRUE_FALSE_QUESTION_VALUE_FALSE Then Response.Write "SELECTED" End If %> value="<%=SUR_TRUE_FALSE_QUESTION_VALUE_FALSE%>"><%=SUR_TRUE_FALSE_QUESTION_VALUE_FALSE%></option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboDisplayType">Display type.</label></span><span class="Required">*</span> Select the format for the response to the True/False question.<br></span>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_1 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_1%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_1%></option>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_2 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_2%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_2%></option>
<option <% If strDisplayFormat = SUR_BOOLEAN_QUESTION_FORMAT_3 Then Response.Write "SELECTED" End If %> value="<%=SUR_BOOLEAN_QUESTION_FORMAT_3%>"><%=SUR_BOOLEAN_QUESTION_FORMAT_3%></option>
</select>
</td>
</tr>
<%
End Select
'Optionally display an option for the maximum number of characters
If DisplayControl(SUR_CONTROL_MAXIMUM_LENGTH, lngComboItemTypeID) = True Then
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtMaximumLength">Maximum length.</label></span> Enter the maximum number of allowable characters for this question.<br></span>
'Optionally display an option for the width of the row text
If DisplayControl(SUR_CONTROL_ROW_TEXT_WIDTH, lngComboItemTypeID) = True Then
%>
<tr>
<td valign="top">
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="txtRowTextWidth">Row heading width.</label></span> Enter the width, in pixels, of the column for the row headings.<br></span>
<span class="InlineHelpSpanStyleBold"><label for="txtRowNames">Row names.</label></span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Enter each row name on a separate line below.</span><br>
'The wording for this section depends on the item type being displayed.
If IsMatrixQuestion(lngComboItemTypeID) = True Then
%>
<span class="InlineHelpSpanStyleBold"><label for="cboItemAnswerGroup">Select column headings.</label></span> <span class="InlineHelpSpanStyle">Select a group of column headings or enter the headings below.</span><br>
<%
Else
%>
<span class="InlineHelpSpanStyleBold"><label for="cboItemAnswerGroup">Select answer choices.</label></span> <span class="InlineHelpSpanStyle">Select a group of answers or enter the answers below.</span><br>
<option <% If CStr(rsAnswerGroups("item_answer_group_id")) = CStr(Request.Form("cboItemAnswerGroup")) Then Response.Write "selected" End If %> value="<%=rsAnswerGroups("item_answer_group_id")%>"><%=rsAnswerGroups("item_answer_group_name")%></option>
<%
rsAnswerGroups.MoveNext
Loop
End If
rsAnswerGroups.Close
Set rsAnswerGroups = Nothing
%>
</select>
<br>
<%
'The wording for this section depends on the item type being displayed.
If IsMatrixQuestion(lngComboItemTypeID) = True Then
%>
<span class="InlineHelpSpanStyleBold">Enter the column headings.</span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Enter each of the column headings in the text boxes below.</span><br>
<%
Else
%>
<span class="InlineHelpSpanStyleBold">Enter the answers.</span><span class="Required">*</span> <span class="InlineHelpSpanStyle">Enter each of the answers in the text boxes below.</span><br>
'Only display the points input box for checkboxes, dropdowns, and option buttons
If CLng(lngComboItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngComboItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Then
'The heading of this section depends on the item type being displayed.
If IsMatrixQuestion(lngComboItemTypeID) = True Then
%>
<a href="javascript:insertNewAnswer();"><img border="0" border="0" alt="Insert a new column" name="btnInsertNewAnswer" src="Resources/Buttons/InsertNewColumnSmall.gif"></a>
<%
Else
%>
<a href="javascript:insertNewAnswer();"><img border="0" border="0" alt="Insert a new answer" name="btnInsertNewAnswer" src="Resources/Buttons/InsertNewAnswerSmall.gif"></a>
<%
End If
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<%
If DisplayControl(SUR_CONTROL_OTHER, lngComboItemTypeID) = True Then
<input type="checkbox" <% If strOtherYesNo = SUR_BOOLEAN_POSITIVE Then Response.Write "checked " End If %> name="chkOther" id="chkOther" style="vertical-align:top">
</td>
<td>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="chkOther">Allow additional answer.</label></span> <label for="txtOther">Check this box if you would like an
additional "Other" answer to allow survey takers to give a different answer. You may edit the text of
the "Other" prompt in the text box below.</label><br></span>
<span class="InlineHelpSpanStyle"><span class="InlineHelpSpanStyleBold"><label for="cboOtherDisplayType">Additional answer input type.</label></span> Select the type
of control that should be used to for the additional answer.<br></span>
<option <% If strOtherDisplayType = SUR_OTHER_DISPLAY_TYPE_TEXTAREA Then Response.Write "SELECTED" End If %> value="<%=SUR_OTHER_DISPLAY_TYPE_TEXTAREA%>"><%=SUR_OTHER_DISPLAY_TYPE_TEXTAREA%></option>
<option <% If strOtherDisplayType = SUR_OTHER_DISPLAY_TYPE_TEXTBOX Then Response.Write "SELECTED" End If %> value="<%=SUR_OTHER_DISPLAY_TYPE_TEXTBOX%>"><%=SUR_OTHER_DISPLAY_TYPE_TEXTBOX%></option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<%
End If
End If
%>
<tr>
<td valign="center" align="right" height="44">
<%
'Only display the Delete button if the item is in EDIT mode, and the survey does not have any responses
If (strState = SUR_STATE_EDIT Or strState = SUR_STATE_EDIT_REFRESH) And flgHasResponses = False Then
Function DisplayControl(strControlName, lngComboItemTypeID)
Dim flgReturnValue
flgReturnValue = False
Select Case CLng(lngComboItemTypeID)
Case SUR_ITEM_HORIZONTAL_RULE:
Case SUR_ITEM_IMAGE:
If strControlName = SUR_CONTROL_HAS_OPTIONS Then
flgReturnValue = True
End If
Case SUR_ITEM_HEADING:
If strControlName = SUR_CONTROL_QUESTION Then
flgReturnValue = True
End If
Case SUR_ITEM_MESSAGE:
If strControlName = SUR_CONTROL_QUESTION Then
flgReturnValue = True
End If
Case SUR_ITEM_HTML:
If strControlName = SUR_CONTROL_QUESTION Then
flgReturnValue = True
End If
Case SUR_ITEM_SINGLE_SELECT_DROPDOWN:
If strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_ANSWER Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_SINGLE_SELECT_OPTIONS:
If strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_ANSWER Or strControlName = SUR_CONTROL_REQUIRED Or strControlName = SUR_CONTROL_OTHER Then
flgReturnValue = True
End If
Case SUR_ITEM_MULTISELECT_CHECKBOXES:
If strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_ANSWER Or strControlName = SUR_CONTROL_OTHER Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_OPEN_ENDED_ONE_LINE:
If strControlName = SUR_CONTROL_MAXIMUM_LENGTH Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_DATABASE_DROPDOWN:
If strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_OPEN_ENDED_COMMENTS_BOX:
If strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_DATE:
If strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_NUMBER:
If strControlName = SUR_CONTROL_MAXIMUM_LENGTH Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_YES_NO, SUR_ITEM_TRUE_FALSE:
If strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_CONSTANT_SUM
If strControlName = SUR_CONTROL_ROW_TEXT_WIDTH Or strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_ROWS Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES
If strControlName = SUR_CONTROL_ROW_TEXT_WIDTH Or strControlName = SUR_CONTROL_MAXIMUM_LENGTH Or strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_ROWS Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_RANKING
If strControlName = SUR_CONTROL_ROW_TEXT_WIDTH Or strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_ROWS Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS, SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES, SUR_ITEM_MATRIX_TEXT_BOXES
If strControlName = SUR_CONTROL_ROW_TEXT_WIDTH Or strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_ROWS Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_ANSWER Or strControlName = SUR_CONTROL_REQUIRED Then
flgReturnValue = True
End If
Case SUR_ITEM_MATRIX_RATING_SCALE
If strControlName = SUR_CONTROL_ROW_TEXT_WIDTH Or strControlName = SUR_CONTROL_RANDOM_ORDER Or strControlName = SUR_CONTROL_ROWS Or strControlName = SUR_CONTROL_HAS_OPTIONS Or strControlName = SUR_CONTROL_QUESTION Or strControlName = SUR_CONTROL_REQUIRED Then
If CLng(lngItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_RATING_SCALE Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Then