The reason why your JavaScript doesn't work here is because the form element
"dir" does not exist.  You can either create a new form element in your
JavaScript, or just add a hidden field to your form (this is what I would
do) and default it to the value of your url.path variable.  If you need to
change the value of the dir variable while the user makes selections on the
client side, just do it with JavaScript.

<SCRIPT LANGUAGE="JavaScript">
<!--
       var JavaScriptPathVariable; //Set this variable on the client side.
       function submit_path() 
          { document.forms[0].dir.value = JavaScriptPathVariable}
       function set_path(myPath)
        { //Call this to change the path - pass in the url that you want to
set
          JavaScriptPathVariable = myPath;
        }
//-->           
</SCRIPT>
        
<form>
        <INPUT TYPE="hidden" NAME="dir"
VALUE="<cfoutput>#url.path#</cfoutput>">
        <INPUT TYPE="submit" NAME="Submit" VALUE="Press to upload"
onsubmit="submit_path();">
</form>

Hope this helps!
Byron

-----Original Message-----
From: Richard Kern [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 15, 2000 7:11 AM
To: [EMAIL PROTECTED]
Subject: JS to CF variable



I have a  #url.path# variable that is dynamically populated.  At the end of
the users selection I need to pass that value to a CFFILE tag as a
destination directory.  Given that this occurs on the page before being
passed to the server, JS makes sense here to collect it on the first page
and convert it to a form variable.

I have tried the following to no avail and would appreciate some insight as
to how to do it.  

Thanks

Richard Kern

----------
<SCRIPT LANGUAGE="JavaScript"
        TYPE="text/javascript">
<!--
       function set_path() 
          {document.forms[0].dir.value = "#url.path#"}

//-->           
</SCRIPT>
        
called at 
        <INPUT TYPE="submit"
          NAME="Submit"
          VALUE="Press to upload"
          onsubmit="set_path();">

2nd page - this produces no output

<CFOUTPUT>
        #FORM.DIR#
        ------

</CFOUTPUT>

        
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to