Thanks everyone.
John,
if I say, var Result = application.ValidateThis.validate(person);
I get error like Variable PERSON is undefined.
In my controller, var ValidateThisConfig = {definitionPath="model/config/"};
tried like otherways /model/config.
All my validation code is in Controller, so I tried my person.xml.cfm file in under controllers.
It is not able to find my person.xml. Is this 'person' my object?
Here i am not creating any object. The method addPerson in the controller calls my person services.
I tried like var ValidateThisConfig = {definitionPath="C:\ColdFusion11\cfusion\wwwroot\Person\model\config\"};
Do I need something like in the controllers?
variables.root = getDirectoryFromPath( CGI.SCRIPT_NAME ).replaceFirst( getContextRoot(), '' );
trojanfresh,
I changed my preson.xml file to person.xml.cfm. where rules are there for required first name etc
If I say
var Result = application.ValidateThis.validate(objectType="person",theObject=rc);
rc scope is availble in controller.
I don't get error but it is not validating my form if I don't enter first name.
my application.cfc has
component extends="org.corfield.framework" accessors="true" {
this.datasource = "jis";
this.sessionmanagement = true;
this.clientManagement = false;
variables.framework = {
action = "action",
usingSubsystems = false,
defaultSubsystem = 'home',
defaultSection = "personadd",
defaultItem = "personadd",
subsystemDelimiter = ':',
siteWideLayoutSubsystem = 'layouts',
error = "main.error",
reload = "reload",
password = "true",
trace = "true",
reloadApplicationOnEveryRequest = true
};
// setup (simple) bean factory:
function setupApplication() {
var bf = new framework.ioc( "model,model/config" );
setBeanFactory( bf );
}
}