Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Private Sub btnGeneratePrivate Sub btnGenerate_Click(ByVal sender  sender As Object, ByVal e  e As System System.EventArgs) Handles btnGenerate btnGenerate.Click
'This example web page demonstrates the Quik! Forms Engine web service and form viewer by loading a hard-coded FormID.
  'A production version of this example would give users the ability to select one or more forms and generate them from a website
'
'Enter the credentials for your Quik! account
strQuikCustID = ConfigurationManager.AppSettings("QuikCustID").ToString 'Your master account CustomerID
strQuikUsername = ConfigurationManager.AppSettings("QuikUsername").ToString 'Your master account username
strQuikPassword = ConfigurationManager.AppSettings("QuikPassword").ToString 'Your master account password Set up the QFE WS object
Dim objQFE As QuikFormsEngineWSv5200 QuikFormsEngineWSv5400.QuikFormsEngineService
objQFE = New QuikFormsEngineWSv5200 QuikFormsEngineWSv5400.QuikFormsEngineService
'Get Set the XML as a string
'Dim xmlDoc As New System.Xml.XmlDocument
'xmlDoc.Load("C:\Temp\LoadXMLExample.xml"to populate on a form (this example is for demo purposes)
Dim strXML As String
'strXML = xmlDoc.OuterXml
strXML = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?><ParentField><Field><FieldName>1own><ParentField><Field><FieldName>1rep.FName</FieldName><FieldValue>Thomas<FieldName><FieldValue>Tom</FieldValue><FieldReadOnly>false</FieldReadOnly><FieldVisibility>1</FieldVisibility><FieldRequired>false</FieldRequired><FieldFormat></FieldFormat><FieldMask>false</FieldMask><FieldCalcOverride>false</FieldCalcOverride><HiddenField>false</HiddenField></Field><Field><FieldName>1own.LName</FieldName><FieldValue>Williams</FieldValue><FieldReadOnly>true</FieldReadOnly><FieldVisibility>1</FieldVisibility><FieldRequired>true</FieldRequired><FieldFormat></FieldFormat><FieldMask>false</FieldMask><FieldCalcOverride>false</FieldCalcOverride><HiddenField>false</HiddenField></Field></ParentField>"
'Create the web service results object
Dim objWSResults As New QuikFormsEngineWSv5200 QuikFormsEngineWSv5400.QuikResultWS
Dim strJava() As String
'Set the customer credentials into the SOAP Header
Dim authHeader As New QuikFormsEngineWSv5200 QuikFormsEngineWSv5400.AuthenticationHeader
authHeader.UserName = strQuikUserName Me.txtUsername.Text
authHeader.Password = strQuikPassword Me.txtPassword.Text
authHeader.CustomerID = strQuikCustID Me.txtCustID.Text
objQFE.AuthenticationHeaderValue = authHeader
objWSResults = objQFE.Execute(
CustomJavaFileIncludePath:=strJava, _
CustomJavaScript:=strJava, _
FormIDs:=Me.txtFormIDs.Text, _
FormExpiryDate:=CDate("5/24/2014"), _
HostFormOnQuik:=True, _
HTMLBodyOnloadFunction:="", _
HTMLFieldFontColor:="", _
HTMLFooter:="", _
HTMLFooterStyle:="", _
HTMLLoadingImage:="", _
HTMLLogoAltText:="", _
HTMLLogoPath:="", _
HTMLMainInstruction:="", _
HTMLMetaNames:="", _
HTMLMinorInstruction:="", _
HTMLReportFormError:="", _
HTMLRequiredBorderColor:="", _
HTMLShowButtonClear:=True, _
HTMLShowButtonPrint:=True, _
HTMLShowButtonReset:=True, _
HTMLShowButtonSave:=True, _
HTMLShowButtonSign:=True, _
HTMLShowButtonSubmit:=True, _
HTMLStyles:="", _
HTMLTitle:="", _
iScrollFilePath:="", _
iScrollOff:=False, _
jQueryBlockUIFilePath:="", _
jQueryFilePath:="", _
jQueryUIFilePath:="", _
LoadXML:=strXML, _
PreviewMode:=False, _
SaveURL:="", _
SignAllDocsCombined:=True, _
SignJavascript:="", _
SignMessage:="", _
SignShowSignNow:=True, _
SignShowVerifyCode:=True, _
SignShowVerifyIDCheck:=True, _
SignSubject:="", _
SignURL:
'Set up the settings object for the Quik! Forms Engine
Dim objQFESettings As New QuikFormsEngineWSv5400.QFESettings
objQFESettings.HTML4Compatible = False 'Only output HTML5 content - set to TRUE if using Internet Explorer 8 or 9
objQFESettings.HTMLButtonPrintName = "PDF" 'Renames the "Print" button to "PDF"
objQFESettings.HTMLShowButtonEmail = False 'Hides the email button
objQFESettings.HTMLShowButtonSign = True 'Shows the Sign button
objQFESettings.OutputTempFiles = False 'Determines if a temp file should be output with the HTML
objQFESettings.HostFormOnQuik = True 'If TRUE, this option generates a URL to the generated form for Quik! to host (including your data)
objQFESettings.PreviewMode = False 'If TRUE, the form will be in PREVIEW mode only and cannot be printed
objQFESettings.SignSubmitCombined = False 'if TRUE the Sign button will perform the Submit action before signing so the Submit button can be hidden
'Load the XML data to show on the form
objQFESettings.LoadXML = strXML
'Set the FormID(s) to display
objQFESettings.QuikFormID = txtFormIDs.Text

'Set up e-sign settings object
Dim objESignType As New QuikFormsEngineWSv5400.ESignTypeDocusign
objESignType.SignAllDocsCombined = False 'TRUE causes all the documents to be bundled together when sent to DocuSign, FALSE will split each form into a separate PDF sent to DocuSign
'For the Self Service and Pass Through e-sign models, you'll need to set the SignURL value
objESignType.SignURL = "https://websvcs.quikforms.com/Docusign/ESignWSVersion/QuikESignTransport5300/QuikSignTransportGetDocusignData.aspxasmx", _
SubmitJavascript:="", _
SubmitURL:="https://websvcs
'For the Callback e-sign model, you'll need to set a SignCallBackURL value with a URL on your server that can receive the envelope ID
objESignType.SignCallBackURL = "http://prewebsvcs.quikforms.com/HTMLFormViewTransDocusign/v5202CallBackTester/FormViewHTML/QFVGetPDF.aspx?Edit=FALSE", _
TestDataMode:=Me.chkTestMode.Checked, _
TestFinalFormsMode:=Me.chkTestForms.Checked _
)
'Check for errors in running the Quik! Forms EngineCallBack.aspx"
'E-Sign environment must match the e-sign vendor's environment for the credentials you're using
objESignType.SignEnvironmentID = 1 'You can set the environment ID as a number or as an Enum, shown in the next line
objESignType.SignEnvironmentID = NSDocusign.ESignTypeDocusign.SignEnvironment.DocuSignPROD
objESignType.SignHideEmptySigners = True 'When TRUE, hide the signing roles in the e-sign popup screen for the roles that have no contact info on the form
objESignType.SignOrderLock = False 'When TRUE do not allow the user to change the order of the signers
objESignType.SignShowVerifyCode = True 'When TRUE show the Verify Code option in the e-sign popup
objESignType.SignShowVerifyIDCheck = True 'When TRUE show the ID Check option in the e-sign popup
'To create single PDF files per FormID in DocuSign, set SignMultipleDocs = True
objESignType.SignMultipleDocs = True
'Assign the e-sign type in the settings object
objQFESettings.ESignType = objESignType

'Run the Quik! software
objWSResults = objQFE.Execute(objQFESettings)
'Check the results of the run event
If objWSResults.ErrorCode <> 0 Then
Response MessageBox.WriteShow(strResultsobjWSResults.Message)
Else
'Write Serve the HTML file to disk and serve to the user
'
' System.IO.File.WriteAllText("c:\tempMe.txtOutputPath.Text & "\sample.html", strResults)
'
''Redirect to the HTML file
'Dim objFile As QuikFormsEngine.QuikFormOutput
'For Each objFile In arrFiles
' Dim strFileName As String = objFile.FullName
' If strFileName = "" Then
' strFileName = "ERROR! No forms were generated."
' Response.Write(strFileName)
' Else
' Response.ContentType = "text/html"
' Response.Redirect(strFileName)
' End If
'Next
'Stream the HTML file out as a response
Dim strHTML As String = objWSResults.ResultData.Tables(0).Rows(0).Item(0)
If strHTML = "" Then
strHTML = "ERROR! No forms were generated."
Response.Write(strHTML)
Else
Response.ContentType = "text/html"
Response.Write(strHTML)
End If
End If
objQFE = Nothing
End Sub

Anchor
_GoBack
_GoBack