Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

All Wayfast controls require some minimum properties to be set in order to tell Wayfast Render Engine how to display them. In this lesson we will review standard settings required for EVERY control in Wayfast.

Why is the Layout tab so important?

The “Layout” tab is a key part of every control as it allows us to indicate Wayfast where to place a control in the UI. We do this by selecting a “place holder” and setting the “order” field. We can also set which CSS class will be applied to each control through these two properties: “Container Style” and “Item Style”.

...

Field

Description

Place Holder

Sets the place holder where Wayfast will place the control. Placeholder name’s are defined in your Layout using a convention. You just prefix HTML tags ids with “PH_” and everything that comes after that in the ID property will be interpreted as a placeholder and displayed as an option in this field. You can use friendly names for your place holders.

Order

Indicates the order for each control in the page. Wayfast Render Engine will use this value while drawing your application in the screen and know which control should be displayed first. Order value can be a decimal intersperse controls.

Alignment

Display the label at the beginning of the row (Normal) or to the right of the previous control contained in the selected placeholder.

Container Style

Sets the CSS Class to apply to the control’s container.

Item Style

Sets the CSS Class to apply to the control’s content.

Conditional tab

Wayfast allows us to manage control’s visibility using conditional clauses. This is helpful for cases when you want to tie UI behavior to some variable like a user role. For instance we could do something like, if User’s Roles is Admin display Save button. Else, hide it. For such condition we use a conditional Syntax. Let’s review how it works.

...

Expression

Result

Description

'&Light'='green'

true

This clause evaluates if &Light variable is equal to “green”. As the variable was actually set to green the result is true.

‘&Light’#'green'

false

This clause evaluates if &Light variable is different than “green”. As the variable was actually set to green the result is false.

‘&Light’='green'|AND|‘&Light’#'yellow'

true

This clause evaluates if &light is green and not Yellow. As &light is green it returns true.

‘&Light’='Red'|OR|‘&Light’='Yellow'

false

This clause evaluates if &light is Red or Yellow. As &light is green it returns false.

...

Example

Let’s create a Dropdown List control control with two options (“Yes”/”No”) and to apply conditions a condition over Button controla Button to make it visible only when the selected option in the Dropdown is “Yes”. If the selected option is “No” the Button will remain hidden. This is a regular scenario on common use case in many applications, if certain field is not selected, then we can’t submit a form.

...

Go No let’s go to “Data Binding” tab and include the list of items that set the option we want to display in our Dropdown.

...

Click on “Submit” button to generate the dropdown Dropdown control.

...

Now that we have the created a Dropdown control created, we can edit our Button to include the conditional in case we need to avoid the submission if there’s any field not selectedcondition to hide it and prevent the from submission when the selected option is different than “Yes”.

Edit the “Button” control and navigate through “Conditional” tab

...

Let’s select “Conditionally” option to analyze understand how it works.

As described before, conditionally “Conditionally” option requires conditional syntax. In this example we are going to use “#” sign to compare if terms are different. On the right side of the expression we are going to include two single quotation marks (') without any value between them to indicate an empty value. It should look like this:

Code Block
'&ActiveDropdownList'#''

Under this conditional sentenceWhen Wayfast needs to render the page when users navigate this page, Wayfast engine will replace “&ActiveDropdownList” control by its term in the conditional sentence by the control’s value and then execute run the comparison. This comparisson comparison will be triggered every time an item in the dropdown is selected.

...

Click Then click on “Submit” button to save these changes.

...

Now we are able ready to verify see if the conditional clause is working as expected. Let’s click on “Preview” button.

...

Since the “Is Active?” dropdown doesn’t have any option selected, the button is not available to submit the form. Once the option is chosen, “Add New User” button will be displayed automatically.

...

Info

We can set multiple conditions using the syntax to create these rules. These are other common examples:

  • &Action=3 that means "&Action equal to 3"

  • &Action#3|AND|&Action#2 that means "&Action not equal to 3 AND &Action not equal to 2"

  • &Action=1|OR|&Action='' that means "&Action equal to 1 OR &Action equal to empty value"

Recap

On this lesson, we reviewed two important sections to setup controls in Wayfast. In the first part, we learnt the Layout importance to indicate where to place our objects in the screen by place and order. In the second part, we had our first approach on Conditional rules that give us the chance to display or edit our objects depending on the clauses that we establish.