GenerateAction
From Plex-XML
Could be used to fill hidden Fields from input fields and optionally submit a form.
This Element is especially useful within search grids with combo boxes or fields in the toolbar because the toolbar is outside the grid form.
Contents |
Hints
- a change event on a date field doesn't work on some browser versions because the onKeyPress stops to propagate an onChange event
- you could observe the submit of a form with <event name="{$vForm}:submit" element="{$vForm}"/> if it is a aaform.form
Properties
generateAction
event
Attributes
- name: Event name: change, click, blur...
- element: ID of the element that is observed (optional)
- elementName: implementation name of the element that is observed (element id could be generated from name)
fill
Attributes
- from: name of the source field (optional)
- fromid: id of the source field (optional)
- fromform: form of the source field (optional)
- fromvalue: fixed value for the traget field (optional)
- to: ID of the target field that should be filled
form
Attributes
- name: name of the target form
- submit: submit form true|false
script
Could be used to put some additional jscript on the end of the function. In the example below a debug message for FireBug is generated.
<script>console.log('Hi Dude, your code is ok!');</script>
Example
Observe the submit event of a grid form + debug script
<xsl:template name="otherHiddenFields"> <generateAction> <event name="{$vForm}:submit" element="{$vForm}"/> <fill fromid="FooFromID" to="FooToID"/> <form name="{$vForm}" submit="false"/> <script>console.log('Hi Dude, your code is ok!');</script> </generateAction> </xsl:template>
Combo box in a toolbar
<button type="otherTemplate" alt="{@label}"> <field hid="{@name}"> <xsl:copy-of select="@label | @shape | @name"/> <xsl:value-of select="@value"/> <xsl:for-each select="selectvalue"> <selectvalue> <xsl:copy-of select="@name | @value | @selected"/> </selectvalue> </xsl:for-each> <generateAction> <event name="change" element="{@name}" /><!-- Change-Event for the field --> <fill from="{@name}" to="anotherFieldID" /><!-- fill anotherField with current Value from this field --> <fill from="scndFieldID" to="thirdFieldID" /><!-- fill thirdField with current Value from a scndField --> <form name="{$vForm}" submit="true" /><!-- do a submit of the specified form --> </generateAction> </field> <xsl:copy-of select="attribute"/> </button>