Search code examples
tomcatcfmllucee

Trouble setting scriptSrc attribute in Lucee CFForm


I'm trying to move a web app from ColdFusion to Lucee, and I'm having trouble getting CFForms to work properly.

The directory structure for my project is: C:\lucee\tomcat\webapps\ROOT\appname\Templates\JavaScripts, where Templates is the directory with my .cfm files. I'm trying to set the scriptSrc attribute of a cfform to point to the JavaScripts directory, but I keep getting a 404 error when the page loads:

<cfform name        = "OfferCreateForm"
            action  = "OfferCreate_Processing.cfm"
            method  = "post"
            onSubmit    = "return(ClientSideValidation() && DoubleSubmissionCheck());"
            scriptSrc= "./JavaScripts">


GET http://127.0.0.1:8888/appname/Templates/JavaScripts/ net::ERR_ABORTED 404

(I've tried a bunch of different things with the scriptSrc such as removing the leading period and slash, specifying the entire path to the directory, etc. with no luck)

When I try to access the files in that directory directly, they will only load if I don't have a trailing slash at the end, which I'm guessing is part of what's going on here. However, I know almost nothing about Lucee or Tomcat so I'm not sure where to go from here.


Solution

  • The solution to this was to put the path to form.cfm itself in the scriptSrc attribute, not the path for the directory that contains form.cfm.

    <cfform name        = "OfferCreateForm"
            action  = "OfferCreate_Processing.cfm"
            method  = "post"
            onSubmit    = "return(ClientSideValidation() && DoubleSubmissionCheck());"
            scriptSrc= "./JavaScripts/form.cfm">