Somehow my last email came out in blank. :(
This is our first time using LightWire and we are king lost :/.
We tried the example provided in the documentation (security/user
manager) also following the LightWire Guide.
We are created our LightWire.cfc and updated the config.xml.cfc.
Tried to use resource bundle in the class model, did not work :(.
Note: We turn of the Autowire, we should not use the autowire if we
have LightWire, is the correct?
Our code:
This is FormValidation test sample class:
<cfcomponent displayname="Form Validation" hint="Form Validation
Component" output="false">
<cfproperty name="valid" type="boolean" default="true"
displayname="Valid" hint="Status of the validation - default is true">
<cfproperty name="errorMessages" type="array" required="true"
displayname="Error Messages" hint="Array of error messages to be
processed by messagebox pluggin">
<cfproperty name="resourceBundle"
type="coldbox:plugin:ResourceBundle" scope="this">
<cffunction name="init" returntype="void" output="false"
displayname="Init" hint="Form Validation Constructor" >
<cfset This.valid = true>
<cfset This.errorMessages = ArrayNew(1)>
</cffunction>
<cffunction name="isRequired" access="public" output="false"
returntype="void" displayname="Required Field" hint="Check if the
value of required field is not blank">
<cfargument name="name" type="string" required="true"
displayname="Name" hint="Name of the field to be validated">
<cfargument name="value" type="string" required="true"
displayname="Value" hint="Value of the field to be validated">
<cfif trim(Arguments.value) eq "">
<cfset This.valid = false>
<cfset ArrayAppend(This.errorMessages,Arguments.name &
GET_RESOURCE_BUNDLE_TEXT) />
</cfif>
</cffunction>
<cffunction name="getErrorMessages" returntype="Array" output="false"
displayname="Get Error Messages" hint="Return error messages">
<cfreturn This.errorMessages />
</cffunction>
</cfcomponent>
In our handler call we have:
<!--- Form Validation --->
<cfobject component="org.iadb.knlsystem.model.util.FormValidation"
name="validator">
<cfset validator.init(This)>
<!--- 1. Validate if Description is blank --->
<cfset validator.isRequired("Description",rc.description)>
<!--- 2. Display error messages if any --->
<cfif ArrayLen(validator.errorMessages)>
<cfset getPlugin("messagebox").setMessage("Error","Error(s): <br /
>",validator.errorMessages) />
</cfif>
So we want the model to access the resource and return error messages
(GET_RESOURCE_BUNDLE_TEXT).
Any easy steps on how to proceed with LightWire?
Thanks....
JC