Form Generation: The Basics

Below you can see sample code to help get you started with generating forms using the Quik! Forms Engine. This is intended to demonstrate the basic functionality of the engine.


Private Sub btnGenerate_Click(ByVal sender As ObjectByVal e As System.EventArgsHandles 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 '


'Set up the QFE WS object
Dim objQFE As QuikFormsEngineWSv5500.QuikFormsEngineService
objQFE = New QuikFormsEngineWSv5500.QuikFormsEngineService


'Set the XML to populate on a form (this example is for demo purposes)
Dim strXML As String
strXML = "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?><ParentField><Field><FieldName>1rep.FName</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></ParentField>"


'Create the web service results object
Dim objWSResults As New QuikFormsEngineWSv5500.QuikResultWS


'Set the customer credentials into the SOAP Header
Dim authHeader As New QuikFormsEngineWSv5500.AuthenticationHeader

authHeader.UserName = Me.txtUsername.Text
authHeader.Password = Me.txtPassword.Text
authHeader.CustomerID = Me.txtCustID.Text 
objQFE.AuthenticationHeaderValue = authHeader


'Set up the settings object for the Quik! Forms Engine
Dim objQFESettings As New QuikFormsEngineWSv5500.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 QuikFormsEngineWSv5500.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/5300/GetDocusignData.asmx"


'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/Docusign/CallBackTester/CallBack.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
     MessageBox.Show(objWSResults.Message)
Else

'Serve the HTML file to the user
     System.IO.File.WriteAllText(Me.txtOutputPath.Text & "\sample.html", objWSResults.ResultData.Tables(0).Rows(0).Item(0))
End If

objQFE = Nothing
End Sub

For help regarding Quik! Forms and the Quik! API
Email: support@quikforms.com | Phone: (877) 456-QUIK