Working with Forms

From Morfikwiki.com

Jump to: navigation, search


Contents


Morfik projects are typically composed of several Forms, bound together by use of SubForm controls. There are several reasons for this, but the most important one is that it makes the process of creating the interface to your website or web-based application easier to manage.

On your Form you place controls and text areas and configure the final design elements.

You can connect Forms to Data sources so that you can create your design without actually having to place content into the design. This allows for the decoupling of data from design and as you can compose a page with multiple different forms, it becomes easy to have pages that show data from multiple origins.

Figure 1 shows a picture of a blank Form as viewed in the Form designer.

Figure 1 – A Form with three bands, as viewed in the Form designer.

Figure 2 shows a picture of the Form Designer within the context of the entire Morfik workspace.

Figure 2 - The Form Designer within the context of the full Morfik workspace.

[edit] Frequently used Properties

The following is a list of the most commonly used properties of Forms, with a short description of their function.

[edit] DataSource

The DataSource property specifies the Table or Query containing the data to be presented in the Form.

[edit] Parameters

The Parameters property is edited by means of a dialog that lists the following:

  • system parameters: these parameters are managed by the Morfik system, and cannot be modified
  • query parameters: if the Form's DataSource is a parametric Query, its parameters will be listed here; their default values may be modified
  • custom parameters: the developer may define additional parameters to be used by the Form

[edit] ViewMode

The ViewMode property specifies how the Form should present the records from its DataSource:

  • vmSingle — single record per page; data is editable
  • vmContinuous — multiple records per page; data is read-only; sorting and grouping may be defined

[edit] Other Properties

The following is a list of the less commonly used properties of Forms with a short description of their function.

[edit] BackgndImage

Set the BackgndImage property if you want to display a graphic behind the Form.

[edit] ColumnCount

Use the ColumnCount property if you wish to display records in a multi-column layout. The ColumnCount property is only relevant for continuous, data-bound forms.

[edit] Cursor

The Cursor property has no effect for Forms; set the Cursor property of the Form's controls instead.

[edit] Font

The Font property has no effect for Forms; set the Font property of the Form's controls instead.

[edit] Hint

The Hint property has no effect for Forms; set the Hint property of the Form's controls instead.

[edit] MaxRecordsPerGroup

Records in continuous Forms may be grouped on particular field(s). Use the MaxRecordsPerGroup property to limit the number of records displayed in a group, or set it to -1 for no limit. The MaxRecordsPerGroup property is only relevant for grouped, data-bound, continuous Forms.

[edit] PageSize

For a continuous Form, the PageSize property specifies the number of records displayed in the Form; set it to -1 if you wish to display all records (note: this may impair performance). For a single Form, the PageSize property specifies the number of records held in the browser-side dataset. The PageSize property is only relevant for data-bound forms.

[edit] RowSpacing

This property is non-functional in the current release.

[edit] SQLFilter

The SQLFilter property may be used to limit the records displayed in the form to those matching certain criteria. Use the same syntax as you would use in the WHERE clause of an SQL statement. For example, to display only those records where Field1 lies between 3 and 5, set the SQLFilter property as follows:

"Field1" BETWEEN 3 AND 5

[edit] Width

The Width property specifies the horizontal extent of the Form.

[edit] Events

In order to handle events from the form, or any other control, you should double click the empty field besides the name of an event in the Event tab of the Properties Window. As a result a code stub for that event will be created and the code editor will be displayed so that the event code can be inserted.

Because of the uniqueness of the WebOS environment, it is important that the developer familiarize himself/herself with the Morfik Form Class’ events, in order to know how to take full advantage of its extensive, built-in, capabilities.

Form events can be grouped into six main categories; most events occur on the browser side. Those that relate to the server side are indicated. Here is a table list of all the form events:


Data Manipulation Events

  • OnBeforeSubmit
  • OnAfterSubmit
  • OnBeforeDataChange
  • OnAfterDataChange


Data Navigation Events

  • OnBeforeDBNavigate
  • OnAfterDBNavigate


Date Refresh Events

  • OnBeforeRefresh
  • OnAfterRefresh


Form Instantiation Events

  • OnDestroy
  • OnCreate
  • OnBeforeExecute (Server Side)
  • OnAfterExecute (Server Side)
  • OnReady
  • OnBeforeShow/OnShow
  • OnAfterShow


User Interface Interaction Events

  • OnBlur
  • OnClick
  • OnContextMenu
  • OnFocus
  • OnKeyDown
  • OnKeyUp
  • OnMouseDown
  • OnMouseMove
  • OnMouseOut
  • OnMouseOver
  • OnMouseUp
  • OnResize
  • OnScroll


Browser Management Events

  • OnReadHistory
  • OnWriteHistory


[edit] Data Manipulation Events

These events fire whenever there is a request made to change any data in the database connected to the document. The order of events is as follows:

1. Request to change data (which may be invoked via the user in the browser or programmatically)

2. OnBeforeSubmit

3. The request to alter data is submitted to the database

4. OnAfterSubmit

5. If successful, OnBeforeDataChange

6. Data is changed

7. If successful, OnAfterDataChange.

[edit] Data Navigation Events

These events fire whenever there is a request made to move from one record to another. The order of events is as follows:

1. Request to navigate between records (which may be invoked via the menu navigator or programmatically)

2. OnBeforeDBNavigate

3. DBNavigate procedure

4. If successful, OnAfterDBNavigate

[edit] Data Refresh Events

These events fire whenever there is a request made to refresh the document with the latest data from the database. The order of events is:

1. Request to refresh the data

2. OnBeforeRefresh

3. If the refresh is successful, OnAfterRefresh.

These events are different, and not to be confused with the Refresh or F5 option associated with the browser, for example Internet Explorer.

[edit] Form Instantiation Events

These events fire whenever there is a request made to create and display a new document. Note some of these events are server side as indicated. The order of events is:

1. Request to create and display a new form (which may be invoked via the browser or or programmatically)

2. OnDestroy (of the old form)

3. OnCreate and the document is created at the server end

4. OnBeforeExecute (performed at the server)

5. The document is sent from the server to the browser end

6. If successful, OnAfterExecute (performed at the server)  

7. OnReady when the document has been fully received by the browser

8. OnBeforeShow fires immediately before the form becomes visible (note: the OnShow event is the same as OnBeforeShow)

9. OnAfterShow fires immediately after the form becomes visible

The OnReady event is associated with the instant that the browser has completed receiving and processing the form and any associated data. Just like the OpenForm function, it serves to enable the developer to easily and almost seamlessly, handle the asynchronous nature of the Web.

An example of when this might be useful is if the developer has created a master-detail relation using a form and subform. It is possible that he or she wishes to activate an event in the subform only when the master form is ready.

[edit] User Interface Interaction Events

These events fire independently in response to user actions.

[edit] OnBlur

The OnBlur event occurs when an visual control (control or document) loses focus either by the pointing device or by tabbing navigation.

[edit] OnContextMenu

This event is non-functional in the current release.

[edit] OnClick

The OnClick event occurs when the mouse button, or any other pointing device button, is single-clicked over the control or document.

On a PC-based mouse it specifically corresponds to a left-mouse click

[edit] OnFocus

The onFocus event occurs when a visual control (control or document) receives focus either by the pointing device or by tabbing navigation.

[edit] OnKeyDown

The OnKeyDown event occurs when a key is pressed down over a visual control (a control or document)

[edit] OnKeyUp

The OnKeyUp event occurs when a key is released over a visual control (a control or document)

[edit] OnMouseDown

The OnMouseDown event occurs when the mouse button, or any other pointing device button, is pressed while it is over a visual control (a control or document). On a PC-based mouse, it specifically relates to the left-hand mouse button being depressed.

[edit] OnMouseMove

The OnMouseMove event occurs when the mouse, or any other pointing device button, is moved while it is over a visual control (a control or document).

[edit] OnMouseOut

The OnMouseOut event occurs when the mouse pointer, or any other pointing device button, is moved out (off) of the region defined by a visual control (a control or document).

[edit] OnMouseOver

The OnMouseOver event occurs when the mouse pointer or any other pointing device is over (within the region defined by it) a visual control (a control or document).

[edit] OnMouseUp

The OnMouseUp event occurs when the mouse button, or any other pointing device button, is released over the control or document. On a PC-based mouse, it specifically relates to when the left-hand mouse button being released.

[edit] OnResize

This event is associated with every time the browser window is resized.

[edit] OnScroll

This event is associated with every time the browser scroll bars are being used

[edit] Browser Management Events

[edit] OnReadHistory

The OnReadHistory event allows you to directly interfere with in processing a URI to restore the form’s state. If you have taken some information out of the form’s written history, in the OnWriteHistory event, you can restore it in the OnReadHistory event.

[edit] OnWriteHistory

This event gives the developer an opportunity to the URI for the Form. It can be used to filter out sensitive information, for example.

[edit] See also

[edit] Related Video

Personal tools