Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Velocity in errorMessage of validator?

    Hi,

    How do we use velocity expressions in the errorMessage?

    E.g. something like this (doesn't seem to be working?):
    Code:
    	<validators>  
                    <validator type="serverCustom">  
                        <serverCondition><![CDATA[ 
                            $value <= $dataSources.StockItem.fetchById($record.itemId).quantity 
                        ]]></serverCondition>  
                        <errorMessage>We don't have $value in stock, only $dataSources.StockItem.fetchById($record.itemId).quantity</errorMessage>  
                    </validator>  
                </validators>

    btw, there is no field 'errorMessage' explained here:
    http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/serverds/Validator.html

    #2
    The errorMessage is not a Velocity context, just a simple text substitution context. See the DMI validation example for how you can make values available for use in the errorMessage (specifically the call to addErrorMessageVariable()).

    Comment

    Working...
    X