Step 6. Create a Messages Pop-Up

At present, your Server Module is invoking the employee file OAM to insert an employee record, and the OAM is performing validation checks. Currently the web page is not handling any messages which are returned.

In this step, you will create a Pop_up component to handle these messages. When a srvroutine is invoked from a web page, the server module returns any validation error messages to your web page as a collection Sys_MsgQ.messages.

To use messages, your web page should clear messages before invoking the srvroutine. After the srvroutine has completed, Sys_MsgQ.messages can be processed using a FOR/ENDFOR loop. Of course, your web page design must also include a way to display these messages. For this component, you will use a Pop_Up component.

1.  Create a New / Reusable Part / New Pop-Up Panel:

     Name: iiiMessagesPopUp

     Description: Messages Pop-Up

     Framework: Personnel and Payroll

     Target Platform: Web Browser.

2.  On the Design tab, Select the Details tab and change pop-up's Caption to Messages

3.  Add a List control. The List control will be named List1.

a.  Using the Layout ribbon, change Size to Fit Both.

b.  This will also add a 1 x 1 table layout to the panel.

4.  Select the List and on the Details tab:

a.  Change ColumnHeaderHeight to 0

b.  Change ColumnLines to False

c.  Change RowLines to False

5.  Locate the field STD_QSEL on the Repository tab and drag and drop it into the List control. This is a 256 long, alphanumeric field.

    This will create a column with the name ColumnSTD_QSEL1.

a.  Change ColumnUnits to Proportion

b.  Change ColumnWidth to 1

6.  Save your Pop-Up component.

7.  Select the Source tab. Create a new method routine name Show.

     When the Show method is invoked by the web page, this routine will:

Clear the List1 control

Process the collection Sys_MsgQ.Messages in a FOR/ENDFOR loop

For each Message in Sys_MsgQ, assign Message.Text to STD_QSEL

Add an entry to List1.

Invoke the ShowPopUp method with a transition of FadeInAndScale.

Your code should look like the following:

Mthroutine Name(Show)

Clr_List Named(#List1)

For Each(#Message) In(#sys_msgq.Messages)

#Std_Qsel := #Message.Text

Add_Entry To_List(#List1)

Endfor

#Com_owner.ShowPopup Transition(FadeInAndScale)

Endroutine

 

8.  Compile the Pop-Up component.