Form Controller

From GeoMedia Smart Client
Jump to: navigation, search





ModalForm

The ModalForm is a special representation of a workflow element. It opens on top of the page, where it was invoked from, and it blocks this page (which is grayed out) as long as it is open.

0202 modalform.png

The request of a ModalForm can be done in several ways:


1. Request of a ModalForm for editing purpose:

 <FormField name="CUSTODY_DATA" ... type="table" ...>
        <FormAction name="EDITCS" label="Edit" action="SCRIPT[IG.openSimpleModalForm({controller: 'CoordinateSystem',form:'RPI_COORDINATESYSTEM', id: {FORM.COORDINATESYSTEM_ID},
closeAction:'reloadFields', closeActionParam:['COORDINATESYSTEM_ID', 'DISPLAYCOORDINATESYSTEM_ID']})]" help="Edit Coordinate system" image="ig-icon-edit"/>
 </FormField>



The parameters for the IG.openModalFormByNodeId - function are:

  • NodeID ... Workflow-NodeID [number]
  • ID ... references the name of the FormField for the FormField-type="table"

Description:

  • First,select the (table-)row to edit.
  • Second, click Edit.
  • Third, the modal form opens on top of the page.


0601 modalform 1.png


2. Request of a ModalForm as empty form:

 
 <FormField ...>
  <FormAction name="NewCS" label="Add CS" action="SCRIPT[IG.openSimpleModalForm({controller: 'CoordinateSystem',
 form:'RPI_COORDINATESYSTEM', emptyform:true, closeAction: 'reloadFields', closeActionParam:['COORDINATESYSTEM_ID', 'DISPLAYCOORDINATESYSTEM_ID']})]" help="Add a new Coordinate system"/>
 </FormField>



The same usage as above, but without the 2nd parameter.




Pfeil new.png To the top Pfeil new.png

Dependency between FormFields

The Workflow-Engine can resolve the dependency between FormFields. This means that certain attributes of one FormField are controlled through the setting in another FormField.


Example 1 - Fill in address data:

An address-search functionality can easily be implemented using an already existing address-database and the type="autocomplete" for the input of, for example, a streetname. The example below is implemented as a two-stage filter; first, the user selects a city (postalcode) from a list of values and then enters a streetname into the second FormField (type="autocomplete").


  1. ...
  2. <FormGroup name="Address_Group" label="Address">
  3.  <FormSingleRow>
  4.    <FormField label="City:" name="SEARCH_CITY" type="combobox" datatype="string" required="false" maxlength="20" visible = "form" persisted="false" 
  5.        lov="SQL[select DISTINCT POSTALCODE,CITY || ' - ' || POSTALCODE from pr_adressearch_v ORDER BY CITY || ' - ' || POSTALCODE]"/>
  6.    <FormField label="Street" name="SEARCH_STREET" type="autocomplete" datatype="string" required="false" maxlength="20" visible = "form" persisted="false" 
  7.        lov="SQL[select id, Street || ', ' || streetnr AS  Adresse from pr_adressearch_v where postalcode={FORM.SEARCH_CITY} and street like {FORM.SEARCH_STREET} || '%']"/>
  8.  </FormSingleRow>
  9.  <FormField label="Street:" name="STREET" type="textfield" datatype="string" required="true" maxlength="50" visible = "form" 
  10.    defaultvalue="SQL[SELECT STREET FROM pr_adressearch_v WHERE ID={FORM.SEARCH_STREET}]"/>
  11.  <FormField label="Number:" name="STREETNR" type="textfield" datatype="string" required="true" maxlength="10"  visible = "form" 
  12.    defaultvalue="SQL[SELECT STREETNR FROM pr_adressearch_v WHERE ID={FORM.SEARCH_STREET}]"/>
  13. ...
  14. </FormGroup>
  15. ...



Example 2 - Set the visibility of FormField:

A check box can easily be used to show/hide other FormFields.

  1. ...
  2. <FormGroup label="Anschrift" name="Address">                
  3.  <FormField label="Lives with:" name="PER_ADDRESS" type="checkbox" datatype="number"  required="false" />
  4.  <FormSingleRow name="Wohnhaft" template="FormSingleRowMiddleTemplate">
  5.    <FormField label="Lastname:" name="ADRESSLASTNAME" datatype="string" maxlength="20" required="false" type="textfield" visible="hidden[SCRIPT[IG.hasValue({FORM.PER_ADDRESS})]]"/>
  6.    <FormField label="Firstname:" name="ADRESSFIRSTNAME" datatype="string" maxlength="20" required="false" type="textfield" visible="hidden[SCRIPT[IG.hasValue({FORM.PER_ADDRESS})]]"/>
  7.  </FormSingleRow>                                
  8. ...
Language: English