Changes

Jump to: navigation, search

SmartCheck Validation

688 bytes added, 14:03, 23 March 2016
no edit summary
=Examples=
====Check an amount is greater than $100,000====
<pre>if(ssParseNum(form.getStr("cf_Amount Requested")) > 100000)
{result.isPassed=false;
}</pre>
====Application Name field black====
<pre>if(form.getStr("sf_Application Name") == "")
{result.isPassed=false;
}</pre>
====Requested Amount less than X====
<pre>if(ssParseNum(form.getStr("cf_Requested Amount")) < "5000")
{result.isPassed=false;
}</pre>
====Number value greater than 5====
<pre>if(ssParseNum(form.getStr("cf_Store Value")) > 5)
{result.isPassed=false;
</pre>
====Single field upload field has no file====
<pre>if("@Single File Field.filename@" == "")
{result.isPassed=false;
</pre>
====Multi file upload field has no files====
<pre>if(ssParseNum("@level1.MUlti upload.numoffiles@") < 1)
{result.isPassed=false;
result.addMsg('Please upload at least one file'); }</pre>
===Comparing two custom date fields with separate custom time fields storing 24 hour time===
<pre>if(form.getStr("cf_Event Start Date")+' '+form.getStr("cf_Event Start Time") >= form.getStr("cf_Event End Date")+' '+form.getStr("cf_Event End Time"))
{result.isPassed=false; result.addMsg('cf_@Event End Time.id@','End Time must take place after the Start Time'); }</pre>  ===Comparing a date custom field to the current date===<pre>if((ssConvertDate(form.getStr("cf_Date"),"@dateformat@", "yyyy-mm-dd") > "@date(currentdate)@") {result.isPassed=false; result.addMsg('cf_@Date.id@','Please enter a date less than or equal to today for the date.'); } </pre>  ===Comparing a date custom field to a date that is six months ago (date must be at least six months ago)===<pre>if(ssConvertDate(form.getStr("cf_Date"),"@dateformat@", "yyyy-mm-dd") > "<!--@sscalculation(DATE_ADD('@date(currentdate)@', INTERVAL -6 MONTH))-->") {result.isPassed=false; result.addMsg('cf_@Date.id@','Date must be at least 6 months prior to today's date'); }</pre>
===To include other scripts into a SmartCheck script:===
2,004
edits

Navigation menu