Difference between revisions of "SmartCheck Validation"
From SmartWiki
(Blanked the page) |
Lorena Ruiz (talk | contribs) |
||
Line 1: | Line 1: | ||
− | + | ==Examples== | |
+ | Number value greater than 5 -> Fail:<pre>if(ssParseNum(form.getStr("cf_Store Value")) > 5) | ||
+ | {result.isPassed=false; | ||
+ | result.addMsg('Some message here'); | ||
+ | }</pre>Multiple File Upload field has no files -> Fail:<pre> | ||
+ | if(ssParseNum("@level1.MUlti upload.numoffiles@") < 1) | ||
+ | {result.isPassed=false; | ||
+ | result.addMsg('Please upload at least one file'); | ||
+ | } | ||
+ | </pre> | ||
+ | Single File Upload field has no file -> Fail:<pre>if("@Single File Field.filename@" == "") | ||
+ | {result.isPassed=false; | ||
+ | result.addMsg('Please upload a file here'); | ||
+ | }</pre>End Date is before Start Date -> Fail:<pre>if (datediff('@date(startdate)@','@date(enddate)@','d') < 0) | ||
+ | {result.addMsg('End date must be later than Start date')); | ||
+ | result.isPassed=false; | ||
+ | } | ||
+ | </pre>To include other scripts from SmartCheck script: | ||
+ | <pre>//@include(AnotherSmartCheckScriptName)</pre> |
Revision as of 10:10, 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'); }Multiple File Upload field has no files -> Fail:
Single File Upload field has no file -> Fail:if(ssParseNum("@level1.MUlti upload.numoffiles@") < 1)
{result.isPassed=false; result.addMsg('Please upload at least one file'); }
if("@Single File Field.filename@" == "") {result.isPassed=false; result.addMsg('Please upload a file here'); }End Date is before Start Date -> Fail:
if (datediff('@date(startdate)@','@date(enddate)@','d') < 0)To include other scripts from SmartCheck script:{result.addMsg('End date must be later than Start date')); result.isPassed=false; }
//@include(AnotherSmartCheckScriptName)