Sample Code for QFE DLL (.NET)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'This example web page demonstrates the Quik! Forms Engine 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
'
Dim objQFE As QuikFormsEngine.QuikFormsEngine
objQFE = New QuikFormsEngine.QuikFormsEngine
'Enter the credentials for your Quik! account
objQFE.QuikCustID = ConfigurationManager.AppSettings("QuikCustID").ToString 'Your master account CustomerID
objQFE.QuikUsername = ConfigurationManager.AppSettings("QuikUsername").ToString 'Your master account username
objQFE.QuikPassword = ConfigurationManager.AppSettings("QuikPassword").ToString 'Your master account password
'Configure settings to run the Quik! Forms Engine
objQFE.ErrorLogPath = "c:\TempOutput\" 'Set the location for the error log
objQFE.OutputTempFiles = False 'If TRUE, writes output files to the computer's temporary directory.
objQFE.OutputPath = "c:\TempOutput\" 'If OutputTempFiles is TRUE, this value is ignored
objQFE.OutputFileName = "MyFileName" 'Set the name the output file (the file extension ".html" will be added automatically)
'For test purposes...
objQFE.TestDataMode = False 'If TRUE, writes each field's name as a default value into the field in order to validate that the form was built properly before publishing the form to PUBLISH status.
objQFE.TestFinalFormsMode = False 'If TRUE, sets the value indicating whether to view forms in final mode
'Configure the form viewer window
objQFE.HTMLTitle = "My Form Viewer Title" 'Sets the title of the HTML page
objQFE.HTMLMetaNames = "<meta name=""viewport"" content=""width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=1.0, maximum-scale=1.0""/>" & _
"<meta name=""apple-mobile-web-app-capable"" content=""yes""/>" & _
"<meta name=""apple-mobile-web-app-status-bar-style"" content=""black""/>" 'Sets the meta names for the HTML page as a single string
'objQFE.HTMLStyles = "" 'Sets the CSS styles for the page as a single string. Be careful about changing this value - be sure to include the entire set of styles
'objQFE.HTMLBodyOnloadFunction = "init()" 'Sets the "onload" function for the Body tag
objQFE.HTMLLoadingImage = "https://www.quikforms.com/shared/images/quikformviewer/loading.gif" 'Sets the path to the loading image to display when the form is loading
objQFE.HTMLLogoPath = "https://www.quikforms.com/shared/images/quikformviewer/logo.png" 'Sets the full URI path to the logo file - 150px wide by 65px tall
objQFE.HTMLLogoAltText = "Quik! Forms" 'Sets the logo image alternate text
objQFE.HTMLMainInstruction = "Fill Out These Forms." 'Sets a custom main instruction on the form viewer
objQFE.HTMLMinorInstruction = "Please fill out the forms below and click SUBMIT when you're done." 'Sets a custom minor instruction on the form viewer
objQFE.HTMLFieldFontColor = "#000000" 'Sets the font color for field data - default is "Blue"
objQFE.HTMLFooter = "Forms powered by Quik! - <a href=""http://www.QuikForms.com"" target=""_blank"">www.QuikForms.com</a>" 'Sets the value to display as the footer
'objQFE.HTMLFooterStyle = "" 'Sets the HTML footer CSS or style in CSS format. Be careful about changing this value - be sure to include the entire set of styles

'-- Buttons –
objQFE.HTMLShowButtonClear = True 'If true, shows the CLEAR button
objQFE.HTMLShowButtonReset = True 'If true, shows the RESET button
objQFE.HTMLShowButtonPrint = True 'If true, shows the PRINT button
objQFE.HTMLShowButtonSave = True 'If true, shows the SAVE and LOAD buttonS
objQFE.HTMLShowButtonSubmit = True 'If true, shows the SUBMIT button
objQFE.SaveURL = "https://www.MyURL.com/SaveForm.html" 'The web page where you want the form to be saved to. NOTE: If set, this overrides the default save button functionality
objQFE.SubmitURL = "https://www.MyURL.com/RecieveData.html" 'The web page where you want submitted data to be posted to
'If you want to create your own javascript to control the submit action, then enter a custom javascript that will run when the Submit button is clicked. By default the submit action will POST the data to a URL, but you can override this functionality to perform validations, AJAX calls, etc.
'objQFE.SubmitJavascript = "$.ajax({url: ""https://websvcs.quikforms.com/HTMLFormViewTrans/v5202/FormViewHTML/QFVGetPDF.aspx?Edit=FALSE?"", type: 'POST', data: $('#QFVFormPage').serialize(),success : function(data) { alert('Print routing succeeded: Form size: '+data.length + ' Bytes');}});"
'objQFE.CustomJavaFileIncludePath = "https://www.MyURL.com/scripts/myCustomScript.js" 'Sets the customer's custom javascript file path in an include statement within the <HEAD> tag. Only provide the URI, as the QFE will create the HTML tags automatically.
'objQFE.CustomJavaScript = "" 'Sets the customer's custom javascript text (function) in HTML format to append to the end of the HTML file. Entire script and proper tags must be included. Multiple scripts can be added as additional items, added to the list in order of preference.
'objQFE.jQueryFilePath = "https://www.quikforms.com/shared/scripts/QFE/jquery-1.9.1.min.js" 'Sets the "src" attribute for the jQuery javascript file to use with the forms. Default version is 1.8.3 located in the "javascripts" folder where the HTML file is saved. ("javascripts/jquery-1.9.1.min.js")
'objQFE.iScrollFilePath = "https://www.quikforms.com/shared/scripts/QFE/iscroll.js" 'Sets the "src" attribute for the iScroll javascript file to use with the forms. Default version is 4.0 located in the "javascripts" folder where the HTML file is saved. ("javascripts/iscroll.js")

'Add the FormIDs to generate
'NOTE: This would generally be done programmatically in a loop for all the forms selected by a user, not by setting explicit hard-coded values
objQFE.AddFormID(12)
objQFE.AddFormID(17)
'Add data to prefill onto the form
'NOTE: This would generally be done programmatically in a loop, not by setting explicit hard-coded values
objQFE.AddFieldToForm( _
FieldName:="1own.FName", _
FieldValue:="Jonathan", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)
objQFE.AddFieldToForm("1own.LName", "Smith", QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, QuikFormsEngine.QFD.FieldVisibility.None)
objQFE.AddFieldToForm( _
FieldName:="1own.H.Addr123", _
FieldValue:="123 Main Street", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)
objQFE.AddFieldToForm( _
FieldName:="1own.H.State", _
FieldValue:="CA", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)
objQFE.AddFieldToForm( _
FieldName:="1own.H.City", _
FieldValue:="Los Angeles", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)
objQFE.AddFieldToForm( _
FieldName:="1own.H.Zip", _
FieldValue:="90007", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired)
'Sample settings
objQFE.PreviewMode = False 'Set to TRUE to display form as preview only
objQFE.HostFormOnQuik = False 'Set to TRUE to return a URL to the HTML form instead of the raw HTML
objQFE.LogoURL = "http://www.quikforms.com"
objQFE.SetFieldPropertyByRole("1own", QuikFormsEngine.QFD.FieldReadOnly.Read_Only)
objQFE.SetFieldPropertyByFieldName("AcctNum", True) 'Mask the input like a password (shows * for each character entered)
objQFE.SetFieldPropertyByFieldName("SSN", "#########") 'Force the value entered to be numeric and formatted (# = number, a = alpha)
objQFE.SetFieldPropertyByFieldName("DOB", QuikFormsEngine.QFD.FieldReadOnly.Read_Only) 'Set all date of birth fields to read-only


'Run the Quik! Forms Engine and return the HTML file name
Dim arrFiles As ArrayList = Nothing
arrFiles = objQFE.Execute
'Check for errors in running the Quik! Forms Engine
If objQFE.Results.ErrorFlag Then
Response.Write("Error: " & objQFE.Results.Message)
Else
'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
'Write the HTML file out as a response
Dim objFile As QuikFormsEngine.QuikFormOutput
For Each objFile In arrFiles
Dim strHTML As String = objFile.HTMLData
If strHTML = "" Then
strHTML = "ERROR! No forms were generated."
Response.Write(strHTML)
Else
Response.ContentType = "text/html"
Response.Write(strHTML)
End If
Next
End If
End Sub

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