Newbie question

35 views
Skip to first unread message

Tim Garver

unread,
Aug 19, 2013, 9:49:56 AM8/19/13
to valida...@googlegroups.com
Whats up group? Nice to be here.

I love this framework.

I am new to it and going to ask some dumb questions. Hopefully not to dumb

Ok, I am using VT version 1.1 manually init().
I setup my configs and instantiate vt and save it into Di/1 framework like so.

<cfset var validatorconfig = { definitionPath="/thismodel/beans/", JSIncludes=false, resultPath="thismodel.ValidatorResult" }>
<cfset Application.thisFactory.addBean( "Validator", new ValidateThis.ValidateThis( validatorconfig ) )>

This works no issues.
My rules for this bean have 15 rules, each are required.
For a test i already have a bean and have my rules defined for it, my beans all live under the beans folder and have individual sub folders for each of them.
I have test data in my tables. and want to know why this is not working.

I grab an object
<cfset t = new thismodel.beans.volunteers.volunteer()>
<cfset v = t.get(350)>
<cfset vx = Application.thisFactory.getBean("Validator")>
<cfset v.setfname("this")>
<cfset v.setmname("should")>
<cfset v.setlname("fail")>
<cfset vr = vx.validate(theObject=v,context='create,update',debuggingMode='strict')>

If i dump the result memento the failures array is empty and the isSuccess is true.
Do i have to manually set it to false?

I just dont understand why this does not fail.

I have tried getting the bean from the db and creating a new one both give me a success validation. In both cases, the success should be a false because all of the fields in the bean are empty.

Thanks in advance for any advice.

Tim

John Whish

unread,
Aug 20, 2013, 7:21:38 AM8/20/13
to valida...@googlegroups.com
You only need to pass in one context. So in your example as you are doing a new "vx" then you'd use the "create" context. Does that help?


--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to validatethis...@googlegroups.com.
To post to this group, send email to valida...@googlegroups.com.
Visit this group at http://groups.google.com/group/validatethis.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages