hi,

I managed to have it working with the following validation rule:

<validator type="required">
 <param name="fieldName">outSamplePeriods</param>
 <message>At least one Out of Sample Period must be provided</message>
</validator>

it displays the message under the <s:fielderror/> entry but does not
display a message on top of the right field name ... how can I have that?

TIA,
regards,
Giovanni

Giovanni Azua wrote:
hi,

I am trying to introduce a validation rule that checks that at least one element has been added to an optiontransferselect UI component. I use the expression type validation but
does not seem to work ... see the details below.

<field name="outSamplePeriods">
  <field-validator type="fieldexpression">
<param name="expression"><![CDATA[ (outSamplePeriods.length > 0) ]]></param> <message><![CDATA[ At least one Out of Sample Period must be provided ]]></message>
   </field-validator>
</field> TIA,
regards,
Giovanni

************************ page.jsp **************************

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<s:form action="[EMAIL PROTECTED]" method="get" theme="%{currentTheme}">
  ...
   <s:optiontransferselect
tooltip="Select all Out-of-Sample Period Ranges corresponding to this Trading Idea"
       label="Out-of-Sample Periods"
       leftTitle="All Periods"
       rightTitle="Selected Periods"
       name="allPeriodRanges"
       list="defaultAllPeriodRanges"
       doubleName="outSamplePeriods"
       doubleList="defaultOutSamplePeriods"
       size="1" multiple="false"
       doubleSize="5" doubleMultiple="true"
       allowAddAllToLeft="false"
       allowAddAllToRight="false"
       allowSelectAll="false"
       allowUpDownOnLeft="false"
       allowUpDownOnRight="false"
   />
   ...
   <s:submit value="Create" align="center"/>
</s:form>

************************ TradingIdea-validation.xml ***************************

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>

<!--  START VALIDATOR: TradingIdea -->

<validators>
   <field name="name">
       <field-validator type="requiredstring">
           <message>Name must be provided</message>
       </field-validator>
   </field>
   <field name="template">
       <field-validator type="requiredstring">
           <message>Template value must be provided</message>
       </field-validator>
   </field>
   <field name="grouping">
       <field-validator type="requiredstring">
<message>Grouping criteria must be provided e.g. DAILY</message>
       </field-validator>
   </field>
   <field name="inSamplePeriod">
       <field-validator type="requiredstring">
           <message>In Sample Period must be provided</message>
       </field-validator>
   </field>
   <field name="outSamplePeriods">
       <field-validator type="fieldexpression">
<param name="expression"><![CDATA[ (outSamplePeriods.length > 0) ]]></param> <message><![CDATA[ At least one Out of Sample Period must be provided ]]></message>
       </field-validator>
   </field>       <field name="utilityFormulas">
       <field-validator type="fieldexpression">
<param name="expression"><![CDATA[ (utilityFormulas.length > 0) ]]></param> <message><![CDATA[ At least one Utility Formula must be provided ]]></message>
       </field-validator>
   </field>    </validators>

<!--  END VALIDATOR: TradingIdea  -->

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to