GenerateSelectButton
From Plex-XML
Contents |
Topic
To facilitate the entry of referenced key values, the use of a selection program can be helpful. If you would like to implement the possibility to jump to a select record function direct from one of the fields on your screen you can use this template.
This template generates an event handler for the F4-key and a
button on the right side of the field. Both will open a new window where the user can search and select one record and give one or more values back into the fields of the form. The field itself is always filled with the first value returned from the select window.
Example
- In the called select record function (MyFindBrowseSelect) you can select a value by clicking on one record
XSLTs
- within an application there should be a XSLT template file "WEB-INF/customized/F4.xslt" where some "global" event handler can be defined
- another place for those handlers could be the PostFieldException template within a specialized XSLT
- usually the called function is a Findbrowse function
XSLT of the calling function
- usually entered into the ""WEB-INF/customized/F4.xslt" " or "postFieldException" template
- usually an edit record function
<!-- within ""WEB-INF/customized/F4.xslt" " or "postFieldException" template -->
<xsl:choose>
...
<xsl:when test="contains(@impl,'MyKeyField')">
<xsl:call-template name="generateSelectButton"><!-- template name to be used -->
<xsl:with-param name="param">
<requestname>MyFindBrowsSelect</requestname> <!-- which Webrequest should be executed to show the Grid we want to select data from -->
<fillField value="MyKeyField" operator="=">MyKeyField</fillField><!-- preset one or more selection fields -->
<returnField>MyDescription</returnField><!-- additional Fields to return from the Select Window. Today we map the fields by Order -->
</xsl:with-param>
</xsl:call-template>
</xsl:when>
...
</xsl:choose>
XSLT of the called selector function (MyFindBrowseSelect)
- usually a FindBrowse grid function
- needed to define which fields of a selected row should be returned to the calling window
<xsl:import href="/WEB-INF/resources/common/DictionaryFindBrowseSelect.xslt"/>
<xsl:template name="gridRowOnClick">
<gridrowonclick>
<onclick>
<selectRow>
<formName>MyFindBrowseSelect</formName><!-- can be any Name unique to this page -->
<param value="{returnvalue[@name='MyKeyField']/@unformatted}"/> <!-- this value will be returned to the edit field where the F4/? was pressed -->
<param value="{returnvalue[@name='MyDescription']/@unformatted}"/><!-- additional return value(s) corresponding to the <returnField>-Definitions in the caller template -->
</selectRow>
</onclick>
</gridrowonclick>
</xsl:template>
XML in the Controller Configuration
- usually in the file controller-config.xml
- to use a standard FindBrowse(Grid) function with another request name define the additional name for the function within the Controller Configuration
<request-handler>
<class>com.com.plexxml.xml.handler.MyFindBrowseHandler</class>
<request>MyFindBrowseSelect</request>
</request-handler>
XML in the Request Configuration
- usually in the file request-config.xml
- defines a web request for the select function
<webrequest name="MyFindBrowseSelect">
<request name="MyFindBrowseSelect" extends="FindBrowse">
<plex-parameter type="fix" name="ControlInput_frmFormat" value="SELECT"/>
</request>
<response>
<error type="default" name="DEFAULT"/>
<reaction type="DEFAULT" target="DISPLAY" name="/WEB-INF/myapp/filter/MyFindBrowseSelect.xslt" localized="true"/>
</response>
</webrequest>

