Difference between revisions of "SmartCheck Validation"

From SmartWiki
Jump to: navigation, search
m
Line 1: Line 1:
 
==Examples==
 
==Examples==
Number value greater than 5 -> Fail:
+
===Number value greater than 5 -> Fail:===
 
<pre>if(ssParseNum(form.getStr("cf_Store Value")) > 5)
 
<pre>if(ssParseNum(form.getStr("cf_Store Value")) > 5)
 
     {result.isPassed=false;
 
     {result.isPassed=false;
Line 6: Line 6:
 
     }
 
     }
 
</pre>
 
</pre>
End Date is before Start Date -> Fail:
+
===End Date is before Start Date -> Fail:===
 
<pre>
 
<pre>
 
if (datediff('@date(startdate)@','@date(enddate)@','d') < 0)
 
if (datediff('@date(startdate)@','@date(enddate)@','d') < 0)
Line 13: Line 13:
 
     }
 
     }
 
</pre>
 
</pre>
To include other scripts from SmartCheck script:
+
===To include other scripts from SmartCheck script:===
 
<pre>//@include(AnotherSmartCheckScriptName)</pre>
 
<pre>//@include(AnotherSmartCheckScriptName)</pre>

Revision as of 11:00, 4 December 2015

Examples

Number value greater than 5 -> Fail:

if(ssParseNum(form.getStr("cf_Store Value")) > 5)
    {result.isPassed=false;
    result.addMsg('Some message here');
    }

End Date is before Start Date -> Fail:

if (datediff('@date(startdate)@','@date(enddate)@','d') < 0)
    {result.addMsg('End date must be later than Start date'));
    result.isPassed=false;
    }

To include other scripts from SmartCheck script:

//@include(AnotherSmartCheckScriptName)