Qdabra Forms - qRules Command Guide Every qRules command, its parameters and behavior All manuals

Chapter 6 - Form, view and UI

First draft. This chapter has not been reviewed yet and may contain mistakes. Please read it with that in mind, and tell us about anything that does not match what you see.

These ten commands connect the form to the page it runs in: read the parameters the form was opened with, form properties and environment variables, load your own CSS and JavaScript, switch views, control autocomplete and character limits, set FormsViewer options, ask the user a question, and accept several files in one drop. Most of them belong on QdabraRules > finishedLoading, so they run once when the form starts. Chapter 1 explains the command syntax, dynamic parameter values and where results go; this chapter assumes you know it.

The examples use this main data source:

my:myFields
  my:TemplateName
  my:SiteUrl
  my:Comments
  my:Status
  my:Attachments
    my:Attachment         (repeating)
      my:File             (file attachment)
      my:Description

6.1 GetInputParameter

Returns the value of a parameter in the address the form was opened with. Use it to make one template behave differently depending on how it was launched, for example by template name, list name or a record ID passed in a link.

Syntax

GetInputParameter /key=<parameter name>
Parameter Required Description
/key Yes Name of the input parameter to read, for example templateName, SPHostUrl or ID.

Result: the parameter's value. Success is false if the parameter is missing or empty.

Examples

GetInputParameter /key=templateName
GetInputParameter /key=SPHostUrl /resultxpath=/my:myFields/my:SiteUrl

The first returns the name the template was opened as. The second writes the SharePoint site address straight into SiteUrl.

Prod and Dev from one template: upload the same template twice, once as ExpenseReport and once as ExpenseReport DEV. On finishedLoading, run GetInputParameter /key=templateName, copy the Result into TemplateName, and let the next rules pick the submit library with a condition such as TemplateName contains DEV. Nothing in the file changes between the two uploads; only the name it was opened as.

Notes

Related: GetFormProperty, GetEnvironmentVariable.

6.2 GetFormProperty

Returns one property of the running form: the browser's user agent, the page address, the SharePoint site or site collection, or when the template was last modified.

Syntax

GetFormProperty /key=CurrentUrl|LastModified|SharePointSiteCollectionUrl|SharePointSiteUrl|UserAgent
Parameter Required Description
/key Yes The property to return. Case-sensitive. See the table below.
Key Returns
CurrentUrl The full address of the page the form is open in, including its query string.
LastModified The date and time the form template was last modified, as YYYY-MM-DDThh:mm:ss in the user's local time, without a time zone.
SharePointSiteCollectionUrl The URL of the SharePoint site collection the template belongs to.
SharePointSiteUrl The URL of the SharePoint site the template belongs to, taken from the SPHostUrl input parameter.
UserAgent The browser's user agent string.

Result: the property value.

Examples

GetFormProperty /key=SharePointSiteUrl /resultxpath=/my:myFields/my:SiteUrl
GetFormProperty /key=LastModified

The first stores the site address for later use in links or connection URLs; the second returns, for example, 2026-10-05T14:32:07.

Notes

Related: GetInputParameter.

6.3 GetEnvironmentVariable

Returns the value of a FormsViewer environment variable. Use environment variables for values that differ between installations or environments (for example a DBXL address), so the template itself does not have to change.

Syntax

GetEnvironmentVariable /key=<variable name>
Parameter Required Description
/key Yes Name of the environment variable. Case-sensitive.

Result: the variable's value. A variable that exists but has no value returns an empty Result with Success true.

Example

GetEnvironmentVariable /key=DbxlUrl

Returns, for example, http://DBXL1/QdabraWebService.

Notes

Related: GetInputParameter, UseOption.

6.4 LoadResource

Loads a CSS style sheet or a JavaScript file into the page, or removes one again. The usual source is a file stored in the template's Resource Files; with extra parameters it can also load a file from another address. A resource file does nothing until it is loaded, so put one LoadResource action per file on finishedLoading.

Syntax

LoadResource /name=<file name> [/type=script|style] [/unload=true]
LoadResource /name=<URL> /allowexternal=true [/useproxy=true] [/type=script|style]
Parameter Required Description
/name Yes The resource file name with its extension (for example full_width.css), or with /allowexternal=true a full URL.
/type No script or style (any case). Needed only when the name does not end in .js or .css.
/unload No true removes a previously loaded resource with this name instead of loading it. Default false.
/allowexternal No true treats a /name that contains / as a URL and loads it from there. Default false.
/useproxy No true fetches the file through the FormsViewer server instead of directly from the browser. Useful for files on SharePoint. Requires /allowexternal=true. Default false.

Result: empty on success.

Examples

LoadResource /name=full_width.css
LoadResource /name=ToggleClass.js
LoadResource /name=https://contoso.sharepoint.com/sites/forms/SiteAssets/theme.css /allowexternal=true /useproxy=true
LoadResource /name=DebugSlider.css /unload=true

The first two load files from the template's Resource Files; the third loads a shared style sheet from a SharePoint library through the FormsViewer server; the last removes a style sheet that was loaded earlier.

Notes

Related: SetDefaultView.

6.5 SetDefaultView

Switches the form to another view. Use it where the Switch views action is not available (for example in a rule on a field), or when the view name is decided at run time.

Syntax

SetDefaultView /view=<view name>
Parameter Required Description
/view Yes The name of the view to switch to, as shown in the designer.

Result: empty on success.

Examples

SetDefaultView /view=Display
SetDefaultView /view-xpath=/my:myFields/my:Status

The first switches to the Display view. The second switches to the view whose name is stored in Status, using a dynamic parameter (see Chapter 1).

Notes

Related: LoadResource, SetCharacterLimit.

6.6 SetAutocomplete

Turns off the browser's typing suggestions and auto-fill for one control or for all controls. Use it for fields where remembered entries are unwanted, such as IDs, amounts or one-time values.

Syntax

SetAutocomplete /mode=disable [/ctrlid=<control ID>]
Parameter Required Description
/mode Yes The autocomplete mode. The only value is disable (lower case). The Command Builder fills it in.
/ctrlid No The control ID (ctrlid) of one control. Omit it to set the mode for every control that has no mode of its own.

Result: empty on success.

Examples

SetAutocomplete /mode=disable
SetAutocomplete /mode=disable /ctrlid=CTRL5

The first disables autocomplete for the whole form; the second for one control only.

Notes

Related: SetCharacterLimit, UseOption.

6.7 SetCharacterLimit

Limits how many characters the user can type into a text control, optionally moving the focus to the next control when the limit is reached. Identify the control either by the field it is bound to or by its control ID.

Syntax

SetCharacterLimit /maxlength=<n> /xpath=<XPath> [/dsname=<data source>] [/view=<view name>] [/movenext=true]
SetCharacterLimit /maxlength=<n> /ctrlid=<control ID> /view=<view name> [/movenext=true]
Parameter Required Description
/maxlength Yes The maximum number of characters, as a whole number.
/xpath One of the two The full path of the field whose controls are limited. A plain path only: it must start with / and contain no //, [, ], ::, *, ., .. or \|.
/ctrlid One of the two The control ID (ctrlid) of one control. Requires /view.
/dsname No Data source of the /xpath field. Omit for the main data source. Only valid with /xpath.
/view No, with /xpath The view that contains the control. With /xpath, omit it to apply the limit in all views. Required with /ctrlid.
/movenext No true moves the focus to the next control when the limit is reached. Default false.

Result: empty on success.

Examples

SetCharacterLimit /xpath=/my:myFields/my:Comments /maxlength=500
SetCharacterLimit /ctrlid=CTRL12 /view=Mobile /maxlength=10 /movenext=true

The first limits Comments to 500 characters in every view; the second limits one control in the Mobile view and jumps to the next control after ten characters.

Notes

Related: SetAutocomplete, SetValue.

6.8 UseOption

Sets a FormsViewer option that changes how the form behaves, such as the way SharePoint lists are queried. Run it on finishedLoading, before anything that depends on the option.

Syntax

UseOption /key=<option name> /value=<option value>
Parameter Required Description
/key Yes The option name. See the table below.
/value Yes The value to set.
Option Values Effect
listquerymode csom (default), rest How SharePoint list connections are queried. rest can return person values for users that have been deleted, where csom produces an error.
listform.attachmentlinkmode default (default), normal, browser How list forms link to attachments. browser opens files that the browser can show (for example .docx, .txt, .xlsx) in the browser; normal links to the file's actual URL, which usually downloads it; default is currently the same as normal.
accessibility.useenhancedtooltips true, false (default) true replaces the browser's native tooltip for controls with a Screentip by an accessible tooltip: it appears on focus and hover, stays while the pointer is over the control or the tooltip, can be closed with Esc or a close button, and is linked to the control with aria-describedby (WCAG 2.1.1 and 1.4.13).

Result: the previous value and the new value, as previous -> new. When the option had no value before, the Result starts with a space, for example -> rest.

Examples

UseOption /key=listquerymode /value=rest
UseOption /key=accessibility.useenhancedtooltips /value=true

The first is the usual fix for "user cannot be found" errors in SharePoint list queries; the second turns on accessible Screentips.

Notes

Related: GetEnvironmentVariable, SetAutocomplete.

6.9 Prompt

Shows a modal dialog with your text and buttons, waits for the user to click one, and returns which one was clicked. Use it to confirm an action (for example before submitting or deleting) or to show a message the user must acknowledge.

Syntax

Prompt [/title=<text>] [/text=<text>] [/type=yesno|yesnocancel|okcancel|ok] [/yestext=<text>] [/notext=<text>] [/oktext=<text>] [/canceltext=<text>]
Parameter Required Description
/title No The dialog title. Default blank.
/text No The message. Shown as plain text, not HTML. Default blank.
/type No The buttons: yesno (default), yesnocancel, okcancel or ok. Not case-sensitive.
/yestext No Label of the Yes button. Default Yes.
/notext No Label of the No button. Default No.
/oktext No Label of the OK button. Default OK.
/canceltext No Label of the Cancel button. Default Cancel.

Result: true for Yes or OK, false for No, and empty for Cancel. Success is true in all three cases.

Examples

Prompt /title=Submit /text=Submit this expense report now? /type=yesno
Prompt /title=Delete rows /text=Delete all rejected rows? /type=okcancel /oktext=Delete
Prompt /text=The report was saved. /type=ok

Notes

Related: UseOption.

6.10 RegisterMultiDrop

Enables dropping several files at once onto the file attachment controls of a repeating group or repeating field. Run it once on finishedLoading for each repeating group that should accept multiple files.

Syntax

RegisterMultiDrop /repeater=<XPath> [/attachment=<relative XPath>] [/xpathsrc=<XPath>]
Parameter Required Description
/repeater Yes The repeating group (or repeating field) that receives the files.
/attachment No The file attachment field, relative to /repeater. Omit it when /repeater is itself a repeating file attachment field.
/xpathsrc No The plain path of the repeating group, without filters. Needed when /repeater contains a filter or other complex syntax.

Result: empty on success.

Examples

RegisterMultiDrop /repeater=/my:myFields/my:Attachments/my:Attachment /attachment=my:File
RegisterMultiDrop /repeater=/my:myFields/my:Files/my:File

The first enables multi-file drop on the Attachment rows, where each row has a File field. The second is for a repeating field that is itself the file attachment.

Notes

Related: Insert.

Back to the Command Index.

© Qdabra Software  |  Questions and corrections: [email protected]  |  Preview copy, not linked from the public site.