Skip to content

Instantly share code, notes, and snippets.

View seancoyne's full-sized avatar

Sean Coyne seancoyne

View GitHub Profile
@seancoyne
seancoyne / example.cfm
Created February 4, 2014 19:39
blog post - validator.cfc - 5
<cfset validator.init() />
@seancoyne
seancoyne / example.cfm
Created February 4, 2014 19:39
blog post - validator.cfc - 6
<cfoutput>#validator.getValid()#</cfoutput>
<cfdump var="#validator.getMessages()#" />
@seancoyne
seancoyne / test.cfm
Created February 4, 2014 19:38
blog post - validator.cfc - 4
<cfset validator.validate(testObj) />
@seancoyne
seancoyne / testObj.cfc
Created February 4, 2014 19:37
blog post - validator.cfc - 3
<cfcomponent name="testObj" output="false">
<cfproperty name="firstName" required="true" type="string" rules="noZeroLengthString" invalidMessage="Please provide your first name" />
<cfproperty name="lastName" required="true" type="string" rules="noZeroLengthString" invalidMessage="Please provide your last name" />
<cfproperty name="email" required="true" type="string" rules="noZeroLengthString,validEmail" invalidMessage="Please provide a valid email address" />
<cfproperty name="dob" required="true" type="string" rules="validDate" invalidMessage="Please provide a valid date of birth" />
<cfproperty name="gpa" required="true" type="numeric" rules="validNumber" invalidMessage="Please provide a valid number for GPA" />
<cfset variables.firstName = '' />
<cfset variables.lastName = '' />
<cfset variables.email = '' />
@seancoyne
seancoyne / example2.cfm
Created February 4, 2014 19:35
blog post - validator.cfc - 2
<cfset testObj = createObject('component','testObj') />
<cfset testObj.setFirstName('sean') />
<cfset testObj.setLastName('coyne') />
<cfset testObj.setEmail('[email protected]') />
<cfset testObj.setDOB('12/26/1981') />
<cfset testObj.setGPA('3.89') />
@seancoyne
seancoyne / example.cfm
Created February 4, 2014 19:34
blog post - validator.cfc - 1
<cfset validator = createObject('component','com.n42designs.validation.validator').init() />
@seancoyne
seancoyne / view.cfm
Created February 4, 2014 19:32
blog post - integrate model glue into farcry - 5
<cfset viewState.setValue('myself',replace(viewState.getValue('myself'),'?','&amp;','ALL')) />
@seancoyne
seancoyne / reactor.xml
Created February 4, 2014 19:32
blog post - integrate model glue into farcry - 4
<constructor-arg name="pathToConfigXml"><value>/mg/mgCal/config/reactor/Reactor.xml</value></constructor-arg>
<property name="mapping"><value>/mg/mgCal/model/data/reactor</value></property>
@seancoyne
seancoyne / model-glue.xml
Created February 4, 2014 19:31
blog post - integrate model glue into farcry - 3
<property name="viewMappings"><value>/mg/mgCal/views</value></property>
<property name="generatedViewMapping"><value>/mg/mgCal/views/generated</value></property>
<property name="configurationPath"><value>/mg/mgCal/config/ModelGlue.xml</value></property>
<property name="scaffoldPath"><value>/mg/mgCal/config/scaffolds/Scaffolds.xml</value></property>
<property name="defaultTemplate"><value>/go/calendar</value></property>
@seancoyne
seancoyne / index.cfm
Created February 4, 2014 19:30
blog post - integrate model glue into farcry - 2
<cfset ModelGlue_LOCAL_COLDSPRING_PATH = getDirectoryFromPath(getCurrentTemplatePath()) & "/config/ColdSpring.xml" />