Qdabra FormsDesigner - User Manual Building form logic with rules All manuals

Quick Start - One Field, Three Rules

Thirty minutes, one text box, one rule of each kind. By the end you will have built a condition, an action rule, a formatting rule, and a validation rule, and seen all three work in FormsViewer. The rest of the manual explains each piece in depth.

You need a template open in FormsDesigner with a text box bound to a field. The walkthrough uses the sample template's Name and PhoneNumber fields; substitute your own.

Step 1 - Select the field and open the Rules pane

  1. Click the Name text box on the canvas.
  2. Click the Rules button in the right panel. The header reads Field Rules - Name and the pane shows three sections: Action Rules, Formatting Rules, Validation Rules.

If the Rules tab is greyed out, nothing is selected yet. Click the control first.

The Rules pane for a field: three sections, each with its own + button.

Step 2 - An action rule: propose the e-mail from the name

Goal: when the user types a name, fill the e-mail box with [email protected] unless an e-mail is already there.

  1. In Action Rules click +. Type the name Propose e-mail.
  2. Click the Condition line ("None - Rule runs when field changes").
  3. In the editor leave the field as Name, choose is not blank, and click OK.
  4. In Run these actions choose Set a field value.
  5. Field: click the picker, choose EmailAddress, OK.
  6. Value: click fx, click Insert Field or Group, choose Name, OK. The box shows . (the rule's own field). Type , "@example.com" around it so the formula reads concat(., "@example.com"), then OK.

The finished action: Field = EmailAddress, Value = concat(., "@example.com").

What you just used: a trigger (Name changes), a condition (Name is not blank), and an action (set another field). Chapter 3 lists the other actions.

Step 3 - A formatting rule: hide the phone box until there is a name

  1. Click the PhoneNumber text box on the canvas.
  2. In Formatting Rules click +. Name it Hide phone until name entered.
  3. Click the Condition line. The field dropdown starts at the parent group, so choose Select a field or group..., expand SampleFields, pick Name, OK. Choose is blank, OK.
  4. Tick Hide this control. The preview reads "(hidden)".

Hide this control with the condition "Name is blank".

Formatting rules describe the state in which the formatting applies: here, "hidden while Name is blank". Chapter 5 covers Disable, colors, and text styles.

Step 4 - A validation rule: the e-mail must contain @

  1. Click the EmailAddress text box on the canvas.
  2. In Validation Rules click +. Name it Email must contain @.
  3. Condition: EmailAddress does not contain, Type text..., @, OK.
  4. Screentip: Enter a valid email address (must contain @).
  5. Leave Show screentip only selected.

The finished validation rule. The condition describes the state that needs attention.

Validation conditions describe the state that needs attention, and the screentip says what to do about it. On its own the rule only draws a red border when a check runs; the sample template's Submit button runs that check with the qRules command GetErrors and shows the messages above the form. Chapter 4 explains this wiring.

Step 5 - Try it

Click Open (Ctrl+O) in the title bar. The draft opens in FormsViewer; no publish is needed to test.

What you do Action rule Formatting rule Validation rule
Open the form Nothing yet Phone box is hidden Nothing yet
Type Hanako in Name and tab out E-mail becomes [email protected] Phone box appears Nothing (e-mail contains @)
Change the e-mail to hanako Nothing (e-mail no longer blank, and Name did not change) No change Red border and message when you click Submit (GetErrors runs)
Clear Name Nothing Phone box hides again No change

The form after typing a name: e-mail filled, phone box visible.

After clicking Submit with an e-mail that has no @: the error text copied from Result and the highlighted field.

Where to go next

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