Overview

Each control available in the designer has properties that give designers the ability to customize the Dynaform layout besides having more control over the behavior, functionality and the use of resources. By customizing the properties of a control, designers can easily create dynamic forms without the necessity of adding extra code. These properties vary according to the control, since they are tailored toward the specific functions of each control.

Type

Available in Controls: All controls

This property simply describes what type of control it is, and is automatically set when the control is added to the design. The value of the Type property is always the name of the control (in the image, the control is "text area", therefore, the value in the Type property is "text"), and cannot be changed by the user.

Variable

Available in Controls: Text and TextArea, Dropdown, Checkbox, Checkgroup, Radio , Datetime, Suggest, Hidden, Grid

This property belongs to all controls that can be related to a variable. The value of the Variable property simply shows the name of the variable related to the control.

To relate a variable in the project to a control added to the Dynaform, go to the Variable property of the control.

Click on the ellipsis ... and a window listing the available variables to relate to the control will be listed.

Select the variable from the list and the window will close automatically. The Variable, Data Type, and the ID properties of the control will all be based on the selected variable.

To remove the variable from the control, click on the 'X' option on the right side of the variable name. To change the variable related to the control, click on the name of the variable and the window listing the available variables will be displayed again.

The controls Text and TextArea, Dropdown, Checkbox, Checkgroup, Radio, Datetime, Suggest, Hidden and Grid will have different variable types.

The table below explains which variables are supported by each control in ProcessMaker version 3.2.

String Integer Float Boolean Datetime Grid Array File Multiple File Object
Text
Textarea
Dropdown
Checkbox
Checkgroup
Radio
Datetime
Suggest
Hidden
File
Multiple File
Grid
Geomap
QRCode

Data Type

Available in controls: Text and TextArea, Dropdown, Checkbox, Checkgroup, Radio, Datetime, Suggest, Hidden

The Data Type property displays the type of variable that has been related to the control. It is worth mentioning that only certain variable types will be available depending on the control. For example, the String variable type is not available for Datetime controls. If no variable is related to the control, then the value of this property will be empty. The Data Type of the variable will be the same as the Variable Type chosen when creating a variable; this property only for identification purposes.

The data type of all available variables will be shown as in the images below:

Protected Value

Available in controls: Text and TextArea, Dropdown, Checkbox and Checkgroup, Radio, Datetime, Suggest and Hidden

The Protected Value property is set to protect the information stored in variables. If the Protected Value field is checked, the variable won't be able to be modified or changed in any way, protecting the value that has been entered. This property helps avoid security issues with the data, and safeguards the integrity of the values in the case an SQL, HTML or Javascript injection needs to be used.

ID

Available in controls: All controls 

All controls must have a unique identifier, which is set in this property. By default, the IDs of all the controls have the ControlTypexxxxxxxxxx format, where xxxxxxxxxx represents the relative number of the control inside the designer. For example, when adding the first text control to the designer the ID set will be Text0000000001.

When a variable has been related to the control, the ID will be set to the name of the variable.

However, in both cases this ID can be edited by entering the new ID in the text field of the property. Take into account that two controls can not have the same ID inside the design.

The ID will change when a variable is added; it will acquire the name of the variable as it's unique identifier. See the images below:

Name

Available in controls: Link, Image, File, Submit and Button

It is possible to add a name to some of the controls managed inside the designer. By default, this property has the same value as the default ID property. When the ID property is changed by the user, the Name property does not change and keeps its original configuration. The Name property can be changed by entering a new value into the value field.

The images below show the results of changing the Name property of all available controls:

Label

Available in controls: Text and TextArea, Dropdown, Checkbox, Checkgroup, Radio, Datetime, Suggest, Title and Subtitle, Link, Image, File, Submit and Button, Grid

This property sets the text that will label the control in the Dynaform. The label should clearly identify the purpose of the field so users know what to input into the field. The label is set in the format ControlType_x, where x represents the relative number of the control in the design.

Note: Changing the Label property in a Dynaform will not change the name of the variable.

For the Title, Subtitle, Button and Submit controls, this property is used to customize the labels of the control fields on the Dynaform. For example, when the Label property of the Title control is changed:

When the Label property of the control is changed, the new label can be seen in the control field on the Dynaform.

Default Value

Available in controls: Text and TextArea, Dropdown, Checkbox, Checkgroup, Radio, Suggest, Hidden, Link

The Default Value property sets the value in the control field if it doesn’t contain any previous value. The value of the Default Value property will also be displayed in the control field on the Dynaform when the value in the control field is null (no value set by the user even if the value is an empty string). Default values also override the SQL and Options properties. This is the order in which the values in the field are set, from lowest to highest priority:

  • First SQL value (minor priority).
  • First Option Value.
  • Default Value (maximum priority)

If the default value is defined, it overrides the Option or SQL property values. If the default value is not set, the value in the Options property overrides the value set by the SQL property.

When the Dynaform is submitted, the default value acts as the input value if nothing was entered into the control field by the user.

The user may alter the default value when filling out the form.

Default values work best for Textbox, TextArea and Suggest controls.

Note: Take into account these rules for variables when working with default values inside Dynaforms.

Placeholder

Available in controls: Text and TextArea, Dropdown, Datetime, Suggest

This property is text set by the designer that usually indicates what should be input inside the field. This text is shown in a lighter color inside This text is shown in a lighter color inside the control field and does not act as input text if the form is submitted and no value is entered by the user into the control field. It just acts as a hint.

When rendering the form, the value of the Placeholder property is shown in the control field as seen in the image below:

Users who enter data into the field do not need to erase the placeholder text. By simply clicking inside the field and starting to type text, the placeholder text disappears.

Here are some examples of how the Placeholder property works with the available controls.

Hint

Available in controls: Textbox, Textarea, Dropdown, Checkbox, Checkgroup, Radio, Datetime, Suggest, Image, File, Grid

This property displays helpful hints to guide users when entering values into the control fields. A hint can be used to provide a fuller explanation of the field or to indicate what values are acceptable for the field. When a field has this property enabled, an ? icon appears to the right of the field when the form is rendered. The hint message pops up when the arrow hovers over the icon.

Define its value by clicking on its text area:

The Hint icon will be only visible in preview mode or while running a case:

Here are some examples of controls with the Hint property activated.

Required

Available in controls: Text and Textarea, Dropdown, Checkbox, Checkgroup , Radio, Datetime, Suggest, File

If the Required property is checked, the user must fill in the control field before submitting the Dynaform. A red asterisk * will be displayed at the right side of the label to indicate that the field is required.

When running a case or viewing the preview of a Dynaform, all required fields will be checked to ensure they are not empty before the Dynaform is submitted. In the case a user tries to submit a Dynaform without filling in a required field, a message is shown indicating that the field is required and the form is not submitted.

For example, the image below shows how controls that have the Required property enabled will notify the user that the field needs to be filled in. If a required field is not filled in, then a message saying that the field is required will appear and the user will not be able to submit the Dynaform until the field is filled in.

Display Mode

Available in controls: Text and Textarea, Dropdown, Checkbox, Checkgroup, Radio), Datetime, Suggest, File Image Grid

This property determines whether the end user will be able to edit the control field or only view it. The modes available in the designer are the following:

  • Parent. This mode inherits the display mode set for the entire Dynaform. Since the display mode hierarchy starts with the properties set for the entire Dynaform, the "parent" display mode is not available in the properties of the entire Dynaform. For example, if the Display Mode property for the entire Dynaform has been set to "disabled", but the display mode in the control is set to "view", the control will be disabled when the Dynaform is rendered by the end user.
  • Edit. The Display Mode property is set to "edit" by default when the control is added. When the Dynaform is rendered, the "edit" display mode allows the user to enter text into the control fields.
  • View. This display mode only shows the label of the control field, and replaces the input box with white space.
  • Disabled. This display mode disables the input box, meaning that the user cannot enter any text into the field.For dropdown, radio, checkbox and checkgroup controls it also disables the selection of options within the control fields. For the Suggest control, it disables the input of text and shows "Untitled" inside the control field.

The Display Mode property also affects the appearance of the field, so the end user can see whether a field is in edit, view or disabled mode. Controls in view mode only have a label, and do not display the outline of the input field. For example, when dropdown controls are in view mode, otheir label is displayed, but the user cannot see the outline of the dropdown box, nor any of the other available options. Radio, Checkbox and Suggest controls display all their available options, but their borders are slightly grayer to indicate that they are in view mode. Controls that have been disabled have the same appearance as controls in the mode, but when the cursor hovers over them, the shape of the cursor changes to a prohibited sign.

The images below show what the control fields look like when the Disabled property is set to edit, view or disabled:

Edit Mode

View Mode

Disabled Mode

Datasource

Available in controls: Text and Textarea, Dropdown, Checkgroup, Radio, Suggest, Hidden

The Datasource property defines the origin of the values in the control. This property has the following available options: "Database" or "Array Variable".

Database

The database option displays the DB connection and SQL properties.

DB Connection

Available in controls: Text and Textarea, Dropdown, Checkgroup, Radio, Suggest, Hidden

This property shows the name of the connection to the ProcessMaker database ("PM Database") or of an existing connection inside the process to an external database. If the connection has been previously set inside the variable related to the control, it will already be set in the DB Connection property, but can be changed by clicking on the name of the database set by default.

A modal window will open listing the existing database connections inside the project. To change the default connection, simply select one of the connections from the list

When the connection changes in the DB Connection property, and the control is related to a variable, the configuration of the variable does not change outside the Dynaform. This property only applies to the current design. Also, if the configuration of the variable changes, that change will not be reflected inside the Dynaform.

This property is directly related to the SQL property, where the query to retrieve the data is set. See the example in the next section to learn about how the DB Connection and SQL properties work together to populate the control field.

SQL

Available in controls: Text and Textarea, Dropdown, Checkgroup, Radio, Suggest, Hidden

This property sets the SQL query that will populate the control field using data from the database chosen in the DB Connection property. The connection of ProcessMaker to its database in MySQL is called "workflow" by default.

SQL queries can work with:

  • Variables that are not assigned to any control in the Dynaform, such as:

    SELECT IC_UID, IC_NAME FROM ISO_COUNTRY WHERE IC_UID = @@COUNTRY
           

    Where @@COUNTRY is not assigned to any control in the Dynaform but its value is set using a trigger.

  • System variables, such as @@USER_LOGGED

    SELECT USR_UID, USR_USERNAME FROM USERS WHERE USR_UID = @@USER_LOGGED          
           
  • Variables assigned and not assigned in the Dynaform to set dependent fields.

    SELECT IC_UID, IC_NAME FROM ISO_COUNTRY WHERE IC_UID <> @@COUNTRY1 AND IC_UID <> @@COUNTRY2
           

    Where @@COUNTRY1 is the variable assigned to the independent field and @@COUNTRY2 is not assigned in the Dynaform.

For example, let's show the complete list of countries inside a dropdown control with the exception of two countries, one set by the user and one set in a trigger.

The table wf_<workspace>.ISO_COUNTRY has a list of countries stored.

Create a Dynaform and place:

  • A textbox assigned to a string variable named "COUNTRY1"
  • A dropdown box assigned to a string variable named "Countries"

Click on the dropdown control field in the Dynaform, go to the SQL property and click on the elipses ... to set an SQL query.

Set the following query:

SELECT IC_UID, IC_NAME FROM ISO_COUNTRY WHERE IC_UID <> @@COUNTRY1 AND IC_UID <> @@COUNTRY2

Now, create a trigger named "Exclude Country2" with the following code:

@@COUNTRY2 = "AR";

Assign the Dynaform to the task's steps and the trigger to be fired before Dynaform.

When a case is run, the control will be populated with a list of all countries, excluding "Argentina", because the value of the variable @@COUNTRY2 was set to "AR" in the trigger.

TTo exclude one more country, write a country UID in the COUNTRY1 textbox. For example, if "AU" is typed in, Australia won't be listed.

Take into account that when there are changes in this property and the control has been related to a variable, the configuration of the variable does not change outside the form. The changes in this property only apply to the current Dynaform design.

Also, if the configuration of the variable changes outside the Dynaform, that change will not be reflected inside the Dynaform.

Note: Take these rules for variables into account when working with this control inside a Dynaform.

For more information about the SQL property and how to use it properly, click here.

Note: Take into consideration that when using a Suggest control with a SQL server, an alias must be used in the query if the same column is needed more than once. This alias will allow the column selected in the query inside the "Suggest" control to be differentiated from itself when used multiple times. In other words, this structure will produce an error:  

SELECT first_name, first_name FROM user_information

Therefore, use the following structure for queries:

 SELECT first_name AS one, first_name AS two FROM user_information

Note: It is strongly recommended to avoid setting a SQL query that retrieves an excessively large amount of data, because it will affect the loading performance of the Dynaform.

Considerations

Before typing a query into the SQL property, take the following into consideration:

  • Table names are case sensitive. To avoid problems caused by using the wrong case, it is best to write the table name exactly as it is in the database. ProcessMaker tables and databases are always created using uppercase letters, and should always be referred to using uppercase letters as well.
    In MySQL, the lower_case_table_names system variable also affects how the server handles identifier case sensitivity; please double-check the value configured in your MySQL to avoid problems.
  • Queries that use double quotes, " ", are not supported in Microsoft SQL Server, PostgreSQL and ORACLE. For this type of query single quotes, '', must be used.

    SELECT * FROM table WHERE c1 = 'Example'

  • Do not end queries with a semicolon character (;) when using a connection to Microsoft SQL Server or PostgreSQL.
  • For queries that include ProcessMaker variables, use single quotes '' to specify that the variable used is a string.

    SELECT column1, column2 FROM table1 WHERE column1 = '@=variable'

    If the variable is a number, do not use quotes.

    SELECT column1, column2 FROM table1 WHERE column1 = @=variableNumber

  • The use of ASC and DESC modifiers, along with the GROUP BY clause, is not supported in Suggest controls.

Array Variable

This option assigns the values of a control using a defined array variable. It is suggested to use array variables for controls that need to be populated dynamically.
When the "Array Variable" option is selected, the Data Variable property is displayed and the SQL and DB Connection properties are hidden.

Data Variable

The Data Variable property sets the array variable used to obtain the control values.

Array Variable

The array variable used in this property has the following characteristics:

  • The array variable values must be set using a Trigger placed before the Dynaform.
  • Any value defined in the lower part of the Create Variable window will be ignored. This means that neither of these values will be added to the pool of the control options.
  • If the variable assigned to the control in the Variable property has defined values, they will be displayed before the array variable values.
  • Like in the Database property, the first column of the array is used as the value of each row, and the second column as the label.

Assigning the Array Variable

Assign the array variable using the @@ button.

Once clicked, a window will open listing all existing array variables.

Once the array variable is selected, it will be set into the Data Variable field.

Remember that any value defined in this array variable through the Create Variable window will be ignored.

Example

Let's combine the values of a string variable assigned to a Dropdown control with array values defined through a Custom Trigger.

Create a Dynaform and drop a Dropdown control inside it. In the Create/Select Variable window, create a string variable named "groupDropdownVar" and define some options. These options will be displayed before the ones assigned in the array variable.

Then, create the array variable that will be assigned in the Datasource property. In this case, this variable will be named "varDataSource".

Go back to the Dynaform and click on the Dropdown control. In its properties, select the option "Array Variable" inside the Datasource property and choose the variable varDataSource from the window list.

Save and close the Dynaform.

Now, create a custom trigger with the name "FillArray" and inside the code assign an array of values to the varDataSource variable.

@=varDataSource = array(
        array('Google', 'Google'),
        array('Yahoo', 'Yahoo'),
        array('Ebay','Ebay'),
        array('Microsoft','Microsoft')
);

Place the trigger before the Dynaform.

Finally, start a case. The dropdown will display the values defined in the string variable plus the ones that were assigned to the array variable in the Trigger.

SQL queries can be used inside the trigger to retrieve array values. For example, to retrieve a list of the current workspace groups:

$result = executeQuery
("SELECT CON_ID, CON_VALUE FROM CONTENT WHERE CON_CATEGORY='GRP_TITLE' AND CON_LANG='en'");
if (is_array($result)) {
        foreach ($result as $row) {
                @=varDataSource[]= array($row['CON_ID'], $row['CON_VALUE']);
        }
}

The dropdown will display the values assigned to its string variable plus the values retrieved from the SQL query in the trigger:

Options

Available in controls: Text and Textarea, Dropdown, Radio, Datetime, Suggest, File Hidden

This property shows, edits and/or adds options to the control that may be related to a variable or not.

A window opens that contains the options set by the variable (if they exist), or, as in the figure below, add options to the control by clicking on Create.

A row with fields enabled to add the options appears below. After setting the key and the label, simply press Enter to add the option.

Click on Apply to save and add the options to the control.

For example, when there is a dropdown control and the values have not been assigned in code, click on Options to populate the dropdown. In this case, the dropdown will be populated by "Yes" and "No" options. See the image below for guidance.

When the options of the control change in this property and the control has been related to a variable, the configuration of the variable does not change outside the form. This property only applies to the current design. Also, if the configuration of the variable changes outside the Dynaform, that change will not be reflected inside the Dynaform.

Note: Take these rules for variables into account when working with this control inside a Dynaform.

Using Variables to Set Dynamic Properties

The following table describes which controls support variables to set dynamic properties:

Label Default Value Placeholder Hint Validate Error Message Max Length Title Format Min Date Max Date Default Date Href
Textbox
Textarea
Dropdown
Checkbox
Checkgroup
Radio
Datetime
Suggest
Hidden
Title
Subtitle
Label
Link
Image
File
Submit
Button
Grid

For example, the variable @@USR_USERNAME can be assigned to the Default Value property of a Textbox control. When running the case, the Textbox field will display the name of the current user as the default value.