Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

$transactionDate / $currentDate not available in Custom Validators? Bug?

$
0
0
Hi Isomorphic,

I have the following validator in my .ds.xml field:
Code:

                                <validator type="serverCustom">
                                        <serverCondition><![CDATA[
                                    ##Required field
                                    #set( $neu = $!value.getTime() )
                                   
                                    ##Can be NULL when adding new entry
                                    #if(          "$!dataSource.fetchById($record.ID).GUELTIGVON" != "" )
                                            #set( $alt = $!dataSource.fetchById($record.ID).GUELTIGVON.getTime() )
                                          #else
                                            #set( $alt = -1 )
                                          #end
                                         
                                          ##New created
                                          $alt == -1
                                          ##Unchanged
                                          || $neu == $alt
                                          ##Moved in future
                                          || ($transactionDate < $neu && $transactionDate < $alt)
                                          ]]></serverCondition>
                                        <errorMessage>Error</errorMessage>
                                </validator>

and get this error message:
Code:

=== 2013-08-23 12:57:32,346 [ec-2] DEBUG Velocity - Null reference [template 'CustomValidator', line 17, column 47] : $transactionDate cannot be resolved.
=== 2013-08-23 12:57:32,347 [ec-2] DEBUG Velocity - Null reference [template 'CustomValidator', line 17, column 74] : $transactionDate cannot be resolved.

What's the correct approach to compare a date value against the current date?

Is it a bug that $transactionDate (as well as $currentDate) are not available in validators?

Thank you,
Blama



My environment:
Firefox 23.0.1
SmartGWT v9.0p_2013-08-17/EVAL Deployment 2013-08-17

Viewing all articles
Browse latest Browse all 4756

Trending Articles