Set conPageCondition = Server.CreateObject("ADODB.Connection")
conPageCondition.Open SURVEY_APP_CONNECTION
If Request.Form("State") = SUR_STATE_EDIT Then
strState = SUR_STATE_EDIT
Else
strState = SUR_STATE_INSERT
End If
'Make sure that an answer has been selected from the answer combo
If Len(Request.Form("cboAnswer")) > 0 And Request.Form("cboAnswer") <> SUR_COMBO_NONE Then
'If the question is a Yes/No, True/False, or database dropdown, the answer ID must be Null.
If CLng(Request.Form("ItemTypeID")) = SUR_ITEM_YES_NO Or CLng(Request.Form("ItemTypeID")) = SUR_ITEM_TRUE_FALSE Or CLng(Request.Form("ItemTypeID")) = SUR_ITEM_DATABASE_DROPDOWN Then
lngAnswerID = SUR_ANSWER_ID_NULL
Else
lngAnswerID = Request.Form("cboAnswer")
End If
Else
lngAnswerID = SUR_ANSWER_ID_NULL
End If
If Len(Request.Form("txtAnswer")) > 0 Then
strAnswer = Request.Form("txtAnswer")
Else
'If the question is a Yes/No, True/False, or database dropdown, use the value from the combo for the answer text.
If CLng(Request.Form("ItemTypeID")) = SUR_ITEM_YES_NO Or CLng(Request.Form("ItemTypeID")) = SUR_ITEM_TRUE_FALSE Or CLng(Request.Form("ItemTypeID")) = SUR_ITEM_DATABASE_DROPDOWN Then
'If the user select --None-- from the combo, insert Null text
If Request.Form("cboAnswer") = SUR_COMBO_NONE Then
strAnswer = SUR_ANSWER_TEXT_NULL
Else
strAnswer = Request.Form("cboAnswer")
End If
Else
strAnswer = SUR_ANSWER_TEXT_NULL
End If
End If
If strState = SUR_STATE_INSERT Then
'Insert the new page condition into the page condition table