SmartCheck Validation
From SmartWiki
Revision as of 14:06, 4 December 2015 by Alvin Thompson (talk | contribs)
Contents
- 1 Examples
- 1.1 Application Name field black -> Fail:
- 1.2 Requested Amount less than X -> Fail:
- 1.3 Number value greater than 5 -> Fail:
- 1.4 Single field upload field has no file -> Fail:
- 1.5 Multi file upload field has no files -> Fail:
- 1.6 End date is before Start date -> Fail:
- 1.7 To include other scripts from SmartCheck script:
Examples
Application Name field black -> Fail:
if(form.getStr("sf_Application Name") == "") {result.isPassed=false; result.addMsg('Application name cannot be blank'); }
Requested Amount less than X -> Fail:
if(ssParseNum(form.getStr("cf_Requested Amount")) < "5000") {result.isPassed=false; result.addMsg('cf_@Requested Amount.id@','Field test message'); }
Number value greater than 5 -> Fail:
if(ssParseNum(form.getStr("cf_Store Value")) > 5) {result.isPassed=false; result.addMsg('Some message here'); }
Single field upload field has no file -> Fail:
if("@Single File Field.filename@" == "") {result.isPassed=false; result.addMsg('Please upload a file here'); }
Multi 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'); }
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)