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