AddFieldToForm Method

Add a Field to Your Form

Use this method to prefill any visible or hidden fields on the forms you are generating with the Quik! Forms Engine. It is recommended that you attempt to fill every field for which you have data-- this ensures that the same data to all of the forms regardless of whether the form has the corresponding field. Any extraneous data supplied to the form is ignored.

Hidden fields can also be added to forms so that you might pass hidden data (e.g. system data you need submitted back but don't want the user to see). Simply add the field with a unique field name and the value to populate and it will be added to the end of the form. Then, when a user submits the form, the hidden data will be submitted too.

There is no need to specify the formID in which the field is going to be pre-filled in AddFieldToForm method. All fields set here will be added in the form package you are generating, that you define in the AddFormID method or QuikFormID property.

Important: When prefilling checkboxes with data, it is imperative that customers remove the "QuikRadio<Form ID #>" prefix from the FieldName value. For example, when attempting to prefill the “QuikRadio38002.1acc.RegType" field, the FieldName value supplied to the form should be “1acc.RegType".

Some examples are described below. 

Basic Usage

Parameters

Parameter

Description

FieldName

Gets or sets the name of the field

FieldValue

Gets or sets the value of the field

FieldReadOnly

Determines if a field is read-only

FieldVisibility

Determines if field is visible or hidden

FieldRequired

Determines if field is required

FieldFormat

Overrides the default field format (if any) for the field. Format is specified as numeric or alphanumeric (# = number, a = alpha, any other character is a literal value (e.g. "(###) ###-####" will create "(310) 555-1222" for the value "3105551222").

FieldMaskFlag

If TRUE, field values are displayed masked (e.g. *********) instead of in clear text.

FieldCalcOverride

Gets or sets whether a field is calculated or not.

HiddenField

If TRUE, the field should be added to the form as an input field with type = hidden.

Using AddFieldToForm in Web Services

REST

In the Quik! Forms Engine REST service, field data and attributes are added to forms via the FormFields object in the /execute/html endpoint.

Code Snippet
"FormFields": [
    {
      "FieldName": "string",
      "FieldValue": "string",
      "FieldBackgroundColor": "string",
      "SemiRequired": true,
      "AttachFile": true,
      "AttachTitle": "string",
      "RequiredByField": "string",
      "RequiredByFieldValues": "string",
      "FieldReadOnly": 0,
      "FieldVisibility": 0,
      "FieldRequired": 0,
      "FieldFormat": "string",
      "FieldMaskFlag": true,
      "FieldCalcOverride": true,
      "HiddenField": true,
      "MaxCharLength": 0
    }
  ],

Legacy Methods - Deprecated and No Longer In Use

SOAP

In the Quik! Forms Engine SOAP service, field data and attributes are added to forms via the FormFields object, which is part of the QFESettings parameter in the Execute endpoint.

Code Snippet
<soap:Header>
   <AuthenticationHeader xmlns="https://websvcs.quikforms.com/quikformsenginews/">
     <CustomerID></CustomerID>
     <UserName></UserName>
     <Password></Password>
   </AuthenticationHeader>
 </soap:Header>
 <soap:Body>
   <Execute xmlns="https://websvcs.quikforms.com/quikformsenginews/">
     <QFESettings>
       <FormIDs></FormIDs>
        <FormFields>
         ...
       </FormFields>
	<QFESettings>

VB.NET

Sample Code
objQFE.AddFieldToForm("1own.FullName", "John Smith")

Here we are adding field with name "1own.FullName" and prefilling it with a value of "John Smith". All fields with that name in the form package will have that value.


All AddFieldToForm overloads

Before listing all different ways of invoking this method, we strongly suggest using the first one that is mentioned, which is described at the bottom of the page. We offer different ways of adding a field into the form package, so that you can specify only the attributes you want to apply into the field, leaving the rest with the default value. The list is shown below.

VB.NET

AddFieldToForm(FormField As QuikFormsEngine.FormField)
AddFieldToForm(FieldName As String, FieldValue As String)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility, FieldRequired As QuikFormsEngine.QFD.FieldRequired)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility, FieldRequired As QuikFormsEngine.QFD.FieldRequired, FieldFormat As String)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility, FieldRequired As QuikFormsEngine.QFD.FieldRequired, FieldFormat As String, FieldMaskFlag As Boolean)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility, FieldRequired As QuikFormsEngine.QFD.FieldRequired, FieldFormat As String, FieldMaskFlag As Boolean, FieldCalcOverride As Boolean)
AddFieldToForm(FieldName As String, FieldValue As String, FieldReadOnly As QuikFormsEngine.QFD.FieldReadOnly, FieldVisibility As QuikFormsEngine.QFD.FieldVisibility, FieldRequired As QuikFormsEngine.QFD.FieldRequired, FieldFormat As String, FieldMaskFlag As Boolean, FieldCalcOverride As Boolean, HiddenField As Boolean)

VB.NET

Sample Code
'Add hidden field 
objQFE.AddFieldToForm( _
FieldName:="TransactionID", _
FieldValue:="123456789", _
FieldReadOnly:=QuikFormsEngine.QFD.FieldReadOnly.NoRestrictions, _
FieldVisibility:=QuikFormsEngine.QFD.FieldVisibility.None, _
FieldRequired:=QuikFormsEngine.QFD.FieldRequired.NotRequired, _
FieldFormat:="", _
FieldMaskFlag:=False, _
FieldCalcOverride:=False, _
HiddenField:=True)

AddFieldToForm(FormField As QuikFormsEngine.FormField)

FormField is a wrapper class for field attributes, so instead of passing the attributes as different parameters of the method, they are set as properties of the FormField object and this last object is passed as the single parameter of the method. This is the current supported method for pre-filling a field into a form package. All new attributes are included here and only here. The full list of attributes are shown below.

FormField Parameters

Parameter

Type

Description

FieldName

String

Gets or sets the name of the field

FieldValue

String

Gets or sets the value of the field

AttachFileBoolIf true, the field will have an attachment icon next to it
AttachTitleStringThe title of the attachment popup
FieldBackgroundColorStringGets or sets the background color of the field, in hexa format. E.g: #CCC

FieldReadOnly

QFD.FieldReadOnly (enum)

Determines if a field is read-only. Enum values:  

  • NotSet = -1
  • NoRestrictions = 0
  • Read_Only = 1  

FieldVisibility

QFD.FieldVisibility(enum)

Determines the visibility of the field. Enum values:

  • NotSet = -1
  • None = 0       
  • Visible_No_Print = 1       
  • Hidden = 2       
  • Visible = 4

FieldRequired

QFD.FieldRequired(enum)

Determines if field is required. Enum values: 

  • NotSet = -1
  • NotRequired = 0
  • Required = 1   

FieldFormat

String

Overrides the default field format (if any) for the field. Format is specified as numeric or alphanumeric (# = number, a = alpha, any other character is a literal value (e.g. "(###) ###-####" will create "(310) 555-1222" for the value "3105551222").

FieldMaskFlag

Bool

If TRUE, field values are displayed masked (e.g. *********) instead of in clear text.

FieldCalcOverride

Bool

Gets or sets whether a field is calculated or not.

HiddenField

Bool

If TRUE, the field should be added to the form as an input field with type = hidden.

RequiredByFieldNameStringSpecifies the name of the field that, if not empty, will force this prefilled field to have a value before submitting. In other words, the prefilled field is required if the reference field has a value
RequiredByFieldValuesString (CSV)Specifies the name of the field that, if having the value specified in this property, will force this prefilled field to have a value before submitting. In other words, the prefilled field is required if the reference field has one of the values specified in this property
SemiRequiredBoolIf TRUE, the field is semi-required, which means that if left empty when submitting, the form will not submit, but a second attempt to submit will be successful, even if the field remains empty
MaxCharLengthStringSets the maximum character length that may be entered into a field. For example, if MaxCharLength = "5", then users may not type a value into a given field that is more than 5 characters long–the value will cut off after the 5th character. However, this field may still be prefilled with data that is longer than 5 characters (maximum length only takes effect when values are manually typed onto the form by users).

VB.NET

Sample Code
Dim formField As New FormField
formField.FieldName = "1ben.FName"
formField.FieldBackgroundColor = "#CCC"
formField.RequiredByField = "1ben.LName"
formField.AttachFile = True
objQFE.AddFieldToForm(formField)

In the example above, field 1ben.FName is pre-filled into the form package with a specific background color. We also made it required when 1ben.LName has some value, and it has an attachment icon next to it for adding attachments into the form package.

Related pages

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