Overview

Sections

Responsive Flex Design & User Engagement

Responsive Design: Flex Forms and Layout Components

We will start building out our customer portal form introducing you to Flex forms and Flex layout components which are necessary to create responsive forms.

Build the customer portal layout

This portal will consist of three different screens. We are going to build out our customer portal where customers can sign in, add items to their cart, and checkout. This is what it will look like:

Customer sign-in page where they can sign in with their Customer ID.

Home page where they can add items to their cart by dragging and dropping.

A cart view, where they can view all of the items they added to their cart.

Launch Mongoose, and open the Web Designer by clicking the icon on the toobar.

Click the New Form Definition icon from the toolbar.

On the Form Wizard Selection modal for the Category field select Flex, and for the Wizard field select Basic. Click Ok.

NOTE: We consider it a best practice to use Flex Forms whenever possible. Flex forms allow you to create forms that are dynamically responsive to the viewing environment. This allows you to create a single form that fits in the browser tablet or mobile device all simultaneously. A flex layout component is a container designed to flexibly organize other components. It can be divided into horizontal or vertical regions, with each region holding multiple child components. Flex layout components can also be nested within regions of other flex layouts, allowing for multiple levels of nesting to meet the needs of your form design. Regions within a flex layout can be grouped either horizontally or vertically. Horizontal boxes arrange regions from left to right, while vertical boxes align them from top to bottom. The length and units attributes control the size of each region, with length defined either in fixed character units or as flex units, which represent equal portions of the available space. You can also combine fixed and flexible units to create both static and dynamic regions within a form. The orientation attribute determines how components are arranged within a region. When the flex layout region is vertically oriented, the align and pack attributes work together to position the child components. Use align to place the components at the left, center, right, or stretch them to fill the entire width of the region. The pack attribute positions the components at the start, center, or end of the region. For horizontally oriented regions, align positions the components at the top, middle, bottom, or stretches them to fill the entire height, while pack positions the components at the start, center, or end of the region.

On the New Form Wizard set the Name field to CustomerPortal and set the Unit field to Char. Click Next and then click Finish.

Once the form opens in the Web Designer, expand the Details pane at the bottom.

Select the Collections tab and click on the Primary Collection: entry. Under the General section on the right, set the Collection field to Orders.

Click the + icon in the bottom left of the Collections tab to add a secondary collection.

Click on the Secondary Collection 2: [New] entry that was just added, and under the General section on the right, set the Collection field to Items.

You will get these warning messages to regen form.

Click Ok.

Click the Regenerate Form Icon.

NOTE: Regenerate a Form will save the form close it and reopen it all in one step. This step is necessary whenever a new collection is added to the form, sometimes you’ll also have to use this when you make UI changes.

Next, we will utilize FlexLayout components to layout our form. Select the FlexLayout component that was automatically added to the form (flexlayoutPane_CustomerPortal). Click the Edit FlexLayout Attributes button located in the top left corner of the component.

NOTE: The FlexLayout attributes can also be accessed by clicking the ellipsis in the Properties panel under Layout -> Flex Attributes. By default the FlexLayout component arranges the regions horizontally.

On the FlexLayout modal, change the Type field to VerticalBox.

Then select each region, and add the following attributes:

ID
Length
Unit
Orientation

Header

4

FormUnit

Fill

Main

1

Flex

Fill

Footer

2

FormUnit

Fill

Header Region Properties:

Main Region Properties:

Footer Region Properties:

Once done adding the attributes, Click Ok.

From the Toolbox panel, select the FlexLayout component and then click into the Header region of flexlayoutPane_CustomerPortal to place it within that region.

With our new FlexLayout component still selected, navigate to the Properties panel and change the Name field to flexLayoutHeader.

Expand the Appearance section and from the drop down set the Theme Class field to BlueBackground.

NOTE: We consider it a best practice to prefix your component names with the component type and to use camel case when naming components.

Click the flexLayoutHeader component and select the Edit FlexLayout Attributes icon in the top left corner.

When the FlexLayout modal opens, click the + icon in the bottom left corner to add another region.

Set the following attributes on each region:

ID
Length
Unit
Orientation
Alignment
Pack
Default Margin

Header

1

Flex

Horizontal

Middle

Start

User

1

Flex

Horizontal

Middle

End

1,0,0,0

Header Region Properties:

User Region Properties:

NOTE: The Margin is defined as left, top, right, bottom in that order. So our Default Margin will set one character to the left and this applies to all of the components within that region.

Click Ok.

From the Toolbox panel, select the Static component and click it into the Header region of flexLayoutHeader.

Using the Properties panel, set the following attributes:

staticHeader

sCustomerPortal

WhiteHeader

Left

40,1.5

True

NOTE: Remember to create the string for the Caption field by clicking on the Caption ellipsis.

Click the Regenerate Form Icon.

You will now see these changes:

Let’s add some spacing to the left of the static component we just added.

Click on the staticHeader component and select the Edit FlexLayout Attributes icon in the top left corner.

Applying the margin here, will only apply it to that single component. If a margin is applied on the FlexLayout itself, it will apply it to all of the components within that region.

Set the Margin field to 2,0,0,0 (Left, Top, Right, Bottom) and click Ok.

NOTE: This will add 2 characters to the left.

From the Toolbox panel, select the Static component and place two of them into the User region of flexLayoutHeader.

Set the following attributes on each of those static components:

Name
Theme Class
Bitmap File
Name
Justification
Binding Type
Binding Size
No Colon

staticCustIcon

CustomerIcon.png

Right

4,1.5

True

staticCustID

WhiteHeader

Left

variable

CustomerID

10, 1.5

True

staticCustIcon Properties:

staticCustID Properties:

Click Binding ellipsis and enter CustomerID in the Variable field.

Click Ok.

Click the Regenerate Form Icon.

You will now see these changes:

We will now build the Footer. From the Toolbox panel, select the FlexLayout component and drop it into the Footer region of the flexlayoutPane_CustomerPortal component.

With our new FlexLayout component selected, in the Properties panel, change the Name field to flexLayoutFooter. For the Theme Class field, select BlueBackground.

Click the Regenerate Form Icon.

You will now see these changes:

From the Toolbox panel, select the FlexLayout component and drop it into the Main region of the flexlayoutPane_CustomerPortal component.

With our new FlexLayout component selected, in the Properties panel, change the Name field to flexLayoutMain.

Click the Edit FlexLayout Attributes icon

Using the + icon, add five more regions to flexLayoutMain.

Set the following attributes on those regions:

ID
Length Unit
Unit
Orientation
Alignment
Pack
Margin
Maximum Length

Menu

20

FormUnit

Vertical

Center

Start

0,1,0,1

Spacer1

1

Flex

SignInPage

5

Flex

Vertical

Center

Start

HomePage

5

Flex

Fill

50

CartPage

5

Flex

Vertical

Stretch

Start

0,1,0,1

65

Spacer2

1

Flex

Menu Region Properties:

Spacer1 Region Properties:

SignInPage Region Properties:

HomePage Region Properties:

Menu Region Properties:

Spacer2 Region Properties:

Click Ok.

Let’s create our menu on the left. From the Toolbox panel, select the Button component and add three of them into the Menu region of flexLayoutMain.

Once the three buttons have been added, set the following attributes on each:

Name
Caption
Theme Class
Size

buttonSignIn

sSignIn

BlueButton

15,2

buttonHome

sHome

BlueButton

15,2

buttonCart

sCart

BlueButton

15,2

NOTE: Make sure to create the string values for each caption, by clicking the Ellipses on the Caption attribute.

buttonSignIn Properties:

When you click the Caption attribute ellipsis, you will see this screen. Click Ok.

buttonHome Properties:

NOTE: Make sure to create the string value for caption, by clicking the Ellipses on the Caption attribute.

buttonCart Properties:

NOTE: Make sure to create the string value for caption, by clicking the Ellipses on the Caption attribute.

Click the Regenerate Form Icon.

You will now see these changes:

This is what the Customer Portal form should look like so far:

Create the customer sign-in page

In this next part, we will build out the customer sign-in page where they can sign in with their Customer ID.

From the Toolbox panel, add the following components into the SignInPage region of flexLayoutMain. In this order, drop three Static components, one Edit component, and one Button component. Set the following attributes on each of those components:

Name
Caption
Theme Class
Bitmap File Name
Justification
Binding Type
Size
No Colon

staticSignIn

sSignIn

Header

Center

_1

20,1.5

True

staticImage1

CustomerSignIn.png

21,8

True

staticCustID2

sCustomerID

Center

20,1.5

True

editCustID

Center

variables.CustomerID

20,1.5

buttonSignIn2

sSignIn

BlueButton

20,1.5

NOTE: Make sure to create the string values for each Caption, by clicking the Ellipses on the Caption attribute.

staticSignIn Properties:

staticImage1 Properties:

staticCustID2 Properties:

editCustID Properties:

For the Binding attribute, click the ellipsis and in the Variable field type CustomerID. Click Ok.

buttonSignIn2 Properties:

For the Caption field, click the ellipsis to add the caption. Click Ok.

Click the Regenerate Form Icon.

Set the Margins on the page.

Select the Static SignIn Component and Click the Edit FlexLayout Attribute button.

Set Margin to 0,1,0,1

NOTE: This will apply a margin of one character at the top and one character at the bottom for the components that we specified.

Click Ok.

Select the Static Image1 Component and Click the Edit FlexLayout Attribute button.

Set Margin to 0,1,0,1

Click Ok.

Select the Button SignIn2 Component and Click the Edit FlexLayout Attribute button.

Set Margin to 0,1,0,1

Click Ok.

Click the Regenerate Form Icon.

This is what our SignInPage region of flexLayoutMain should look like so far:

Create the home page

In this next part, we will build out the home page region where users can view and add items to their cart.

From the Toolbox panel, select the FlexLayout component and drop it into the HomePage region of flexLayoutMain.

With the new FlexLayout component still selected, in the Properties panel, set the Name field to flexLayoutHome. Notice that because the region it is sitting in is set to fill, it fills up the entire region.

With flexLayoutHome still selected, click the Edit FlexLayout Attributes icon.

On the FlexLayout modal, change the Type field at the top to VerticalBox.

Click the + icon in the bottom left corner to add four additional regions.

Add the following attributes to those regions:

ID
Length
Unit
Orientation
Alignment
Pack

Header

4

FormUnit

Horizontal

Middle

Center

Spacer

1

FormUnit

Horizontal

Top

Start

Grid

2

Flex

Fill

Spacer2

1

FormUnit

Horizontal

Top

Start

Buttons

1

Flex

Fill

Header Region Properties:

Spacer Region Properties:

Grid Region Properties:

Spacer2 Region Properties:

Buttons Region Properties:

Once finished, click Ok.

From the Toolbox panel, select the FlexLayout component and drop it into the Buttons region of flexLayoutHome.

With the new FlexLayout component still selected, in the Properties panel, set the Name field to flexLayoutButtons.

Then click the Edit FlexLayout Attributes icon.

On the FlexLayout modal click the + icon in the bottom left corner to add two more regions.

Set the following attributes on those regions:

ID
Length
Unit
Orientation
Alignment
Pack

Count

1

Flex

Horizontal

Top

End

Spacer

1

FormUnit

Horizontal

Top

Start

Cart

1

Flex

Horizontal

Top

Start

Count Region Properties:

Spacer Region Properties:

Cart Region Properties:

Click Ok.

The form should look like this.

From the Toolbox panel, select the Static component and drop it into the Header region of flexLayoutHome.

With the component still selected, using the Properties panel, give it the following attributes:

Name
Caption Theme
Class
Justification
Size
No Colon

staticHome

sHome

Header

Center

20,1.5

True

NOTE: Make sure to create the string values for each Caption, by clicking the Ellipses on the Caption attribute.

From the Toolbox panel, select the Grid component and drop it into the Grid region of flexLayoutHome.

With the grid component still selected, on the Properties panel, set the Name field to gridItems. Under the Data Source section, set the Binding Type field to Secondary Collection and set the Binding field by clicking on the ellipsis and selecting Secondary Collection of Items (See screen print below) This will set the Binding attribute to objects2.

Selecting Secondary Collection.

Click the Regenerate Form Icon.

This is what our HomePage region of flexLayoutMain should look like so far:

Summary:

We introduced flex forms and flex layout components and got started building our consumer end user interface for the customer portal.

Here is the Part 7 video showing the detailed steps to complete the previous tasks.

Was this section helpful?

What made this section unhelpful for you?

On this page
  • Responsive Flex Design & User Engagement
View as Markdown

Ask an AI

Open in ChatGPTOpen in Claude