Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

double validation, help

 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have to double field to validate. This field only exists when the promotion type is 'SP' or 'MP'. So I cannot use "double" function to validate it.

However, *this* >0 seems not to work for double. Any comment is welcome.

<field property="claimInfo.payoutInfo.amount" depends="validwhen">
<arg0 key="ClaimInfo.PayoutInfo.Amount"/>
<var>
<var-name>test</var-name>
<var-value>(((claimInfo.promotionInfo.type != "SP") and (claimInfo.promotionInfo.type != "MP"))
or ((*this* != null) and (*this* > 0)))
</var-value>
</var>
</field>


Dan
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe "validwhen" works for anything but simple existence tests.

In order to do what you want, you can either:
  • Write your own custom validation rule or
  • use te validate() method of your action form for just this one rule while still using the validation framework for the other rules
  •  
    danny liu
    Ranch Hand
    Posts: 185
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    after some investigations, I found out this is a bug of "validwhen". A custom validation needs to be attached.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic