JSMin plugin with cfForm

I know this might be outside of Coldbox, but I was hoping someone had
seen this before. I am using the JSMin plugin to minify css and js,
which works fine in most cases. The problem I run into is when I use
cfform on a page. For some reason, I then see two calls to my
minified code, and one of them is a bad url.

Example, I use the following in my Main Layout:

#getMyPlugin("JSMin").minify("/amp/includes/styles/reset.css,/amp/
includes/styles/blueprint.css,/amp/includes/styles/
buttons.css,includes/styles/main.css,etc,etc,etc")#

"/amp" is a mapping to our main codebase, but this is run from a sub
site. "includes" is sub site only code.

This produces a GET to:

http://aa.amp.local/includes/cache/52522147-ef43-4a3f-b087-d0faf850ac5a.css

BUT, when I call a page that has a cfform on it, I see 2 calls to the
css (in Firebug NET tab):

GOOD URL - http://aa.amp.local/includes/cache/52522147-ef43-4a3f-b087-d0faf850ac5a.css
BAD URL - http://aa.amp.local/index.cfm/security/includes/cache/52522147-ef43-4a3f-b087-d0faf850ac5a.css

As you can see, the second one (it is actually called first) includes
"index.cfm/security", which results in a 404, which redirects to our
homepage. Obviously this is not good.

Has anyone seen something like this before? Obviously I can do
validation without cfform, but I actually like cfform (am I still in
the minority on that?)

Thanks for any insight,

Ken

Yes you are in the minority :slight_smile:

Check your baseurl setting within your pages' <body> tag.

Also, is the following link printed in the source or is that what the
browser is fetching?

'http://aa.amp.local/index.cfm/security/includes/cache/52522147-
ef43-4...'

Thanks,

-A

I figured it out.

In coldbox config:

<Setting name="jsmin_cacheLocation" value="includes/cache" />

needs to have the / in front of it:

<Setting name="jsmin_cacheLocation" value="/includes/cache" />

Seems to be working well now...

Thanks,

@Aaron, that link was what the jsmin plugin used for the cached file,
it is auto generated.

BTW, I still don't know why only when using CfForm does that behavior
show up. Oh well.

Super Amazing Awesome Fantastic!

Seriously :slight_smile: