Page definitions for the extended example

The example consists of four web pages. For each page, we show the code followed by a brief explanation. Put the code for these pages into the configuration.bigexamplepages.xml file. Remember to add the opening <Configuration> tag and the closing </Configuration> tag.

Notice how much code is re-used in the page definitions. This is normal with Arcos, and once you know how to define a page, you will find it very easy to create other pages.

This help page is designed for landscape printing.

Input search page

<Page PageName="InputSearch">
   <DataSource Name="rstSearch">
      <SYS_Recordset_GetDefaultRecord/>
   </DataSource>

   <SYS_Form Name="frmSearch"/>

   <SYS_Button Name="btnSearch" RecordsetName="rstSearch" value="Search now" DefaultButton="1"
             Section="PR_FormPassedNew">
      <SYS_Session_SetValue NameToSet="Search" Value="{rstSearch.Search}"/>
      <SYS_Action_GoToPage PageName="SearchResults"/>
   </SYS_Button>

   <SYS_Display_Template TemplateFile="LOCAL_InputSearch">
      <SYS_AutoTemplate_Form FormName="frmSearch">
         <SYS_AutoTemplate_RecordListEdit ComponentName="rstSearch">
            <Property Name="RowButtons">
               <Property Value="btnSearch"/>
            </Property>
         </SYS_AutoTemplate_RecordListEdit>
      </SYS_AutoTemplate_Form>
   </SYS_Display_Template>
</Page>

Explanation of new code

<SYS_Button Name="btnSearch" RecordsetName="rstSearch" value="Search now" DefaultButton="1" Section="PR_FormPassedNew">

DefaultButton. This property (with value = 1) specifies that the button is the default button. In other words, when the user presses the Enter key on the keyboard, the effect is the same as clicking this button. This property is particularly useful if there is more than one button.

<SYS_Session_SetValue NameToSet="Search" Value="{rstSearch.Search}"/>

Here we create a session value.

NameToSet. This is the name that we give to the session variable. Later, we can retrieve the value using {Session.Search}

Value. This property specifies the value that we give to the session variable. In this case, we use the curly-bracket (tagged expression) syntax to assign the value that is contained in the Search field of the rstSearch recordset.

Search results page

<Page PageName="SearchResults">
   <DataSource Name="tblFriends">
      <SYS_Recordset_GetWhere >
         <Property Name="SelectUsing">
            <Property>
               <Properties FieldName="Name" Op="containsi" Value="{Session.Search;CONST.NULL}"/>
            </Property>
         </Property>
      </SYS_Recordset_GetWhere>
   </DataSource>

   <SYS_Form Name="frmSelectFriend"/>

   <SYS_Button Name="btnSendMail" value="Send Mail" RecordsetName="tblFriends" Section="PR_FormPassed">
      <SYS_Session_SetValue NameToSet="FriendEmail" Value="{tblFriends.Email}"/>
      <SYS_Action_GoToPage PageName="Post" Section="PR_FormPassed"/>
   </SYS_Button>

   <SYS_Display_Template TemplateFile="LOCAL_SearchResults">
      <SYS_AutoTemplate_Form FormName="frmSelectFriend">
         <SYS_AutoTemplate_RecordColumnList ComponentName="tblFriends">
            <Property Name="FieldFilterExt">
               <Property><Properties FieldName="Name"/></Property>
               <Property><Properties FieldName="Email"/></Property>
            </Property>
            <Property Name="RowButtons">
               <Property Value="btnSendMail"/>
            </Property>
         </SYS_AutoTemplate_RecordColumnList>
      </SYS_AutoTemplate_Form>
   </SYS_Display_Template>
</Page>

Explanation of new code

<SYS_Recordset_GetWhere >

Create a recordset that contains a subset of the records in the table.

<Property Name="SelectUsing">

Specify how the data will be selected, using properties in the lines that follow this one.

<Properties FieldName="Name" Op="containsi" Value="{Session.Search;CONST.NULL}"/>

FieldName. The name of the field in the table on which the selection criterion is specified.

Op. The selection operation. containsi will select all records in which the Name field contains the specified value. The letter i indicates that the search is not case-sensitive. For a case-sensitive search use: contains

Value. This is the value on which the search is performed. In this case, we use the curly-bracket (tagged expression) syntax to assign the value that is contained in the session value called "Search". It is possible for a user to access this SearchResults page directly. If that happens, the session value "Search" will not be defined. We use ;CONST.NULL to ensure that the code performs correctly (it will return the entire set of records).

Post page

<Page PageName="Post">
   <DataSource Name="rstMail">
      <SYS_Recordset_GetDefaultRecord/>
   </DataSource>

   <SYS_Form Name="frmSendMail"/>
   <SYS_Button Name="btnMail" RecordSetName="rstMail" value="Send Mail" Section="PR_FormPassedNew">
      <SYS_Action_SendTaggedEmail>
         <Properties To="{Session.FriendEmail}"  Subject="{rstMail.Subject}"
                     Message="{rstMail.Message}" From="me@somename.co.uk"/>
      </SYS_Action_SendTaggedEmail>
      <SYS_Action_GoToPage PageName="MailSent"/>
   </SYS_Button>

   <SYS_Display_Template TemplateFile="LOCAL_PostMail">
      <SYS_AutoTemplate_Form FormName="frmSendMail">
         <SYS_AutoTemplate_InsertHTML HTML="Enter your message for {Session.FriendEmail}"/>
         <SYS_AutoTemplate_RecordListEdit ComponentName="rstMail">
            <Property Name="FieldFilterExt">
               <Property><Properties FieldName="Subject"/></Property>
               <Property><Properties FieldName="Message"/></Property>
            </Property>
            <Property Name="RowButtons">
               <Properties Value="btnMail"/>
            </Property>
         </SYS_AutoTemplate_RecordListEdit>
      </SYS_AutoTemplate_Form>
   </SYS_Display_Template>
</Page>

Explanation of new code

<SYS_Action_SendTaggedEmail>

As the name suggests, send an email.

<Properties To="{Session.FriendEmail}" Subject="{rstMail.Subject}" Message="{rstMail.Message}" From="me@somename.co.uk"/>

The session value FriendEmail comes from the previous page. The subject and message of the email are obtained using the PostMail template, which is specified later on this page.

From. Use your own email address with this property.

Message page

This page displays a message when the mail has been sent.

<Page PageName="MailSent">
   <SYS_Display_Template TemplateFile="LOCAL_MailSent"/>
</Page>

The page requires a template, so create the template file called MailSent.html in the /config/template directory. For example, use this simple code:

<HTML>
  <BODY>
    <H1>Your mail has been sent.</H1>
  </BODY>
</HTML>