Use search fields in the toolbar

From Plex-XML
Jump to: navigation, search

HowTo: Use search fields in the toolbar:

Contents

General example

<-- Toolbar definition -->
<toolbar>
 <xsl:for-each select="$vPath/PleXMLIntern/XMLOutput/tab/group/row/returnvalue[@implname='TradeDateFrom']">
  <button type="otherTemplate" alt="{@label}">
   <field type="input" name="TradeDateFrom" hid="tmpTradeDateFrom" length="{@maxl}">
    <xsl:copy-of select="@label | @shape"/>
    <xsl:value-of select="@value"/>
   </field>
   <xsl:copy-of select="attribute"/>
  </button>
 </xsl:for-each>
</toolbar>

<-- Hidden Input-Fields because the toolbar is not in the grid form-element-->
<xsl:template name="otherHiddenFields">
 <field name="TradeDateFrom" id="TradeDateFromID" type="hidden">
  <xsl:value-of select="$vPath/PleXMLIntern/XMLOutput/tab/group/row/returnvalue[@implname='TradeDateFrom']/@value"/>
 </field>

 <-- Generate an event-handler to capture the form:submit event and fill the hidden field from the toolbar field -->
 <-- generate action is not in the toolbar element because the form-id is not jet registered there -->
 <generateAction>
  <event name="{$vForm}:submit" element="{$vForm}"/>
  <fill fromid="tmpTradeDateFrom" to="TradeDateFromID"/>
  <form name="{$vForm}" submit="false"/>
 </generateAction>
</xsl:template> 

Full-text-search

Full-text-search could be defined for each field within the format definition. If you have defined one or more fields for full text a search field is generated in the toolbar.

Toolbar-fulltext.png

ComboBox

<button type="otherTemplate" alt="{@label}">
 <field hid="{@name}" type="{$itype}">
  <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}" />
   <fill fromid="FooID" to="Input_Foo" />
   <form name="{$vForm}" submit="true" />
  </generateAction>
 </field>
 <xsl:copy-of select="attribute" />
</button>

Date

Hint.png

  • Hint: a change event on a date field doesn't work on some browser versions because the onKeyPress stops to propagate an onChange event
  • Hint: Use Date-Iso fields because it will be difficult to format date7 in put fields
  • Hint: Use format in your request-config:
<plex-parameter type="web" format="yyyy-MM-dd" name="RestrictTradeDate_CM_TradeDateToISO">TradeDateTo</plex-parameter>


Date-toolbar.png

From-To-Date example

 <-- vPath variable with xPath to your request because it is easier to use and to change --!
 <xsl:variable name="vPath" select="/responses/response[@request-name='CMFB702AE']"/>

 <-- Toolbar definition -->
 <xsl:template name="toolbar">
   <toolbar>
     <xsl:call-template name="gridtoolbar"/>

     <-- Toolbar-Fields, be sure to use XMLOutput fields otherwise you won't have attributes for label, shape etc. -->
     <-- Date from -->
     <xsl:for-each select="$vPath/PleXMLIntern/XMLOutput/tab/group/row/returnvalue[@name='wrkDatVon']">
       <button type="otherTemplate" alt="{@label}">
         <field type="input" name="tmpDatumVon" hid="tmpDatumVon" length="{@maxl}">
           <xsl:copy-of select="@label | @shape"/>
           <xsl:value-of select="@value"/>
         </field>
         <xsl:copy-of select="attribute"/>
       </button>
     </xsl:for-each>

     <-- Date to -->
     <xsl:for-each select="$vPath/PleXMLIntern/XMLOutput/tab/group/row/returnvalue[@name='wrkDatBis']">
       <button type="otherTemplate" alt="{@label}">
         <field type="input" name="tmpDatumBis" hid="tmpDatumBis" length="{@maxl}">
           <xsl:copy-of select="@label | @shape"/>
           <xsl:value-of select="@value"/>
         </field>
         <xsl:copy-of select="attribute"/>
       </button>
     </xsl:for-each>
     
   </toolbar>
 </xsl:template>

 <-- Hidden Input-Fields because the toolbar is not in the grid HTML-Form-Element -->
 <-- You should use the value attribute in this case otherwise your selection won't work in Exel/PDF exports-->
 <xsl:template name="otherHiddenFields">
   <field name="wrkDatumVon" hid="wrkDatumVon" type="hidden"><xsl:value-of select="$vPath/returnvalue[@name='wrkDatVon']/@value"/></field>
   <field name="wrkDatumBis" hid="wrkDatumBis" type="hidden"><xsl:value-of select="$vPath/returnvalue[@name='wrkDatBis']/@value"/></field>
   
   <-- Generate an event-handler to capture the form:submit event and fill the hidden field from the toolbar fields -->
   <-- generateAction could/should be used instead of Event.observe in additionalJavaScriptFunctions -->
   <generateAction>
     <event name="{$vForm}:submit" element="{$vForm}"/>
     <fill fromid="wrkDatumVon" to="tmpDatumVon"/>
     <fill fromid="wrkDatumBis" to="tmpDatumBis"/>
     <form name="{$vForm}" submit="false"/>
   </generateAction>	
 </xsl:template>

 <-- Generate an event-handler to capture the form:submit event and fill the hidden field from the toolbar fields -->
 <xsl:template name="additionalJavaScriptFunctions">
   <additionalJavaScriptFunctions>
     <xsl:text>
       Event.observe($('HAFB101AE'), 'HAFB101AE:submit', function({
        $('wrkDatumVon').value=$('tmpDatumVon').value;
        $('wrkDatumBis').value=$('tmpDatumBis').value;});
     </xsl:text>
   </additionalJavaScriptFunctions>    
 </xsl:template>
Personal tools