<%'Include Data Connection%> <%'Include ADO constants include file for VBScript%> <% 'open data connection OpenConn() %> <% Dim intDynamicFormId Dim strClientLanguage Dim strCurrentURL Dim strFeedback 'get the dynamic form id intDynamicFormId = Session("DynamicFormId") 'if a form entry was submitted and the process page redirected the user back to this one then... If Request.QueryString("suc") <> "" Then 'get the language strClientLanguage = Request.QueryString("lang") 'get the dynamic form recordset Set rsDynamicForm = GetDynamicForm(intDynamicFormId) 'according to the success status value: Select Case Request.QueryString("suc") 'if the success status is 1 (success) then... Case "1" 'let the user know everything went well strFeedback = rsDynamicForm("DYNAMIC_FORM_FEEDBACK_" & strClientLanguage) 'if the success status is 2 (you've already filled out this form) then... Case "2" 'let the user know that they can't fill out this form twice strFeedback = rsDynamicForm("DYNAMIC_FORM_ALREADY_FILLED_OUT_FEEDBACK_" & strClientLanguage) 'if the success status is anything other than 1 (success) then... Case "3" 'let the user know that an error has occurred Select Case strClientLanguage Case "fr" 'let the user know that they can't fill out this form twice strFeedback = "Une erreur est survenu lors de l'envoi du questionnaire, veuillez ré-essayer plus tard." Case Else 'let the user know that they can't fill out this form twice strFeedback = "An error has occurred while submitting your form, please try again later." End Select End Select 'if the submission id was submitted (so we can submit to an external form) then... If Request.QueryString("sub") <> "" And IsNumeric(Request.QueryString("sub")) Then 'get the submission id intSubmissionId = Request.QueryString("sub") 'get the language strClientLanguage = Request.QueryString("lang") 'get external from url array Dim strExternalURL, arExternalURL, intURLCounter Dim rsDynamicForm Dim intIsAdmin intDynamicFormId = CInt(Request.QueryString("id")) intIsAdmin = Request.QueryString("admin") strExternalURL = rsDynamicForm("DYNAMIC_FORM_EXTERNAL_FORM_URL_" & strClientLanguage) 'split the URL list into the array arExternalURL = Split(strExternalURL, ",") 'for every URL: For intURLCounter = 0 To UBound(arExternalURL) 'if the array element is not an empty string then... If Trim(arExternalURL(intURLCounter)) <> "" Then 'submit to external form Response.Write("" & vbCRLF) End If Next End If 'close the recordset rsDynamicForm.Close Set rsDynamicForm = Nothing 'display feedback message: Response.Write "

" & strFeedback & "

" 'if a form entry was not submitted (we are displaying the form) then... Else 'diplay dynamic form: 'get the url strCurrentURL = Request.ServerVariables("URL") 'get user's preference of language strClientLanguage = Mid(strCurrentURL, Len(strCurrentURL)-5, 2) 'this statement assumes that all URLs will end in either '-en.asp' or '-fr.asp'. 'if the language preference does not equivalate to either 'en' or 'fr' then... If LCase(strClientLanguage) <> "en" And LCase(strClientLanguage) <> "fr" Then 'default language preference to english strClientLanguage = "en" End If 'diplay dynamic form Response.Write GetDynamicFormHTML(Session("DynamicFormId"), strClientLanguage) End If 'close data connection Call CloseConn() %>