Validate This In A Cold Box

11 views
Skip to first unread message

Adam

unread,
Jul 30, 2009, 12:40:09 AM7/30/09
to ValidateThis!
Bob,

I just grabbed the recent build from riaforge and set out to work on
my first attempt to integrate VT with a CB3 app in development. .While
getting started, I run into this technicality...

I want to get JSLib initialization <script> for my layout template
which is where my <head> and all my other global <script> blocks are
defined.. This lead me to an error if I don't pass an object or
objecttype to the plugin getInitalizationScript() facade.. I noticed
there that theObject and ObjectType arguments are both optional...
hrm.

Application Execution Exception
Error Type: ValidateThis.ValidateThis.ObjectTypeRequired : [N/A]
Error Messages:
You must pass either an object type name (via objectType) or an actual
object when calling a method on the ValidateThis facade object.
Tag Context:
ID: CFTHROW
LINE: 93
Template: \\vs1\wwwroot\frameworks\ValidateThis\ValidateThis.cfc
ID: CF_UDFMETHOD
LINE: 67
Template: \\vs1\wwwroot\frameworks\ValidateThis\ValidateThis.cfc
ID: CF_TEMPLATEPROXY
LINE: 75
Template: \\vs1\wwwroot\xxx\xxx\xxx\plugins\ValidateThis.cfc
ID: CF_TEMPLATEPROXY
LINE: 3
Template: \\vs1\wwwroot\xxx\xxx\xxx\views\home.cfm
ID: CFINCLUDE
LINE: 131
Template: \\vs1\wwwroot\frameworks\coldbox\system\plugins
\Renderer.cfc
ID: CF_UDFMETHOD
LINE: 15
Template: \\vs1\wwwroot\xxx\xxx\xxx\layouts\Layout.Main.cfm
ID: CFINCLUDE
LINE: 226
Template: \\vs1\wwwroot\frameworks\coldbox\system\plugins
\Renderer.cfc
ID: CF_TEMPLATEPROXY
LINE: 200
Template: \\vs1\wwwroot\frameworks\coldbox\system\Coldbox.cfc
ID: CF_TEMPLATEPROXY
LINE: 76
Template: \\vs1\wwwroot\xxx\xxx\xxx\Application.cfc

After this error.. I started poking around and came to the thinking
that getInitializationScript() in the BOValidator or some variant of
it should actually be implemented in the ValidateThis factory or
facade. This could then get js initialization directly from a
clientscriptwriter rather then relying onMissingMethod which in this
case has failed in the attempt to get some undefined object's
BOValidator instance so it could use the clientvalidator to delegate
to the clientscriptwriter to generateInitializationScript() for me
when I just needed <script> init for in my generic layout..

I'm thinking maybe you could use the clientscriptwriter in the factory
directly but I'm not yet sure what exact changes should/could be
made.. and I'm not trying to criticize or re-engineer VT or anything
like that.. I just know that at the time I call for
getinitializationscript(), a formName or theObject may not yet be
available to the application, and that these items change per each
request/object/context/form.

To make things a bit more complicated, I have already initialized the
jQuery framework in my layout since I use it to make ajax calls to a
coldboxproxy.cfc that runs event handlers which will return html or
json results to be dealt with by a jquery plugin to have content
pushed into layout areas.. However, I do not have the validation
plugins that VT likes setup yet. In this case It might be cool to have
an optional includeJSLib=true argument in the facade's
getInitializationScript() implementation for use in these types of
situations so that if includeJSLib=false developers would just get the
needed <script> tags for any js plugins from the appropriate
ClientScriptWriter and VT would let my app manage the core library
initialization and/or extension in the layout before VT gets involved.

I am going to continue digesting the VT implementation and see if I
can figure out a nice solution for my needs that does not require many
changes to either of our methodologies, but I am very interested to
hear your thoughts on some of the items above and I look forward to
further cb+vt related discussion around here..

regards,
Adam

Bob Silverberg

unread,
Jul 30, 2009, 7:35:27 AM7/30/09
to valida...@googlegroups.com
Adam,

Those are some good points. In the evolution of the framework I simply
made everything a call to a BOValidator, mainly because originally
there was no ValidateThis facade and all calls to the framework were
made via your Business Objects, so you were always talking to a
BOValidator. With the introduction of the facade that has changed,
and I believe you are correct that a BOValidator is unnecessary for JS
initialization. I'll take a look at where it might make sense to put
getInitalizationScript() outside of the BOValidator.

I'm already in the process of breaking getInitalizationScript() apart
into smaller methods that build up all of the script in pieces, so
that a developer could just ask for part of the Initalization Script
if they plan to implement some of the JS themselves. That should
address your issues with wanting to initialize jQuery yourself.

Let me know if these items address all of your current concerns.

Cheers,
Bob
--
Bob Silverberg
www.silverwareconsulting.com

Adam Drew

unread,
Jul 30, 2009, 5:29:52 PM7/30/09
to ValidateThis!
>  I'll take a look at where it might make sense to put
> getInitalizationScript() outside of the BOValidator.

Awesome!

> I'm already in the process of breaking getInitalizationScript() apart
> into smaller methods that build up all of the script in pieces.

Awesome!


Thanks,

Adam



Bob Silverberg

unread,
Jul 30, 2009, 5:42:04 PM7/30/09
to valida...@googlegroups.com
I've actually just finished these two items. The changes that I had
to make to the framework make some of this stuff much cleaner
(internally anyway), so thanks for the suggestions. I'm going to try
to get a release out tomorrow, although I still have a few items to
address before I can do that.

Cheers,
Bob
--
Bob Silverberg
www.silverwareconsulting.com

Adam Drew

unread,
Jul 30, 2009, 5:54:11 PM7/30/09
to ValidateThis!
> The changes that I had to make to the framework make some of this stuff much cleaner (internally anyway),

Awesome! I may have a CB+VT sample app to show by the end of next
week. I am on a few deadlines right now but I'm a one man show so I
can't spend as much time as i would like to on VT alone right now...

I also have some other issues which I will be addressing shortly after
I see your newest re-factor.

Thanks,
Adam
Reply all
Reply to author
Forward
0 new messages