[ColdBox 3.5.1] - CB Validation Engine question...

Hi,

Does anyone know of a basic working example of the Validation engine that is now in ColdBox? Perhaps it’s been there a while, and I just didn’t utilize it, but I see how to wire up my ColdBox.cfc config file, but I’m not sure how it correlates to my form.

For example:

validation = {
sharedConstraints = {
loginForm = {
email = {required=true}, password = {required=true}
}
}
};

So in my view I have a login form called dspLogin.cfm and it has two fields named email and password. What else do I need to do to wire the validation up with my form. How does ColdBox know where to look? I must be missing something. I did look in the docs,but they seemed to point to more just setting it up in ColdBox.cfc or within the object itself. I’m trying to get it to work using ColdBox.cfc.

Any help appreciated…

The name you gave the shared constraint key is the key here: “loginForm”,

So you can validate with those shared constraints

validateModel(target=rc, constraints=“loginForm”);

The constraints argument can be the actual structure or a simple string which then ColdBox uses to look in the shared constraints.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano