473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Passing File Path through JavaScript in an ASP Web Utility

Hello everyone! I admit up front that I am new at this and have very little knowledge of JavaScript, but we have an asp web form that allows for the manipulation of letters our company regularly uses. In the administration of this web utility, a user can update the file path of a Word document. Here is the relevant asp code for the admin page:

Expand|Select|Wrap|Line Numbers
  1.         while not rst.EOF
  2.             %>
  3.  
  4.                         <input type=hidden name=letterid value=<%=rst("ql_guid")%>>
  5.                         <tr bgcolor=<%=bgcolor%>>
  6.                             <form name=do_list_update&mycount action=index.asp method=post>
  7.                             <input type=hidden name=mode value='update_list'>
  8.                             <input type=hidden name=myguide value='<%=rst("ql_guid")%>'>
  9.                             <input type=hidden name=filepath value="">
  10.                             <td width="20%"><input name=letter_name value='<%=rst("ql_name")%>' size=25></td>
  11.                             <td width="40%"><%=rst("ql_path")%></td>
  12.                             <td width="20%"><input type=file size=30 name=letter_path value=<%=Request("filepath")%>></td>
  13.                             <td width="10%" align="center"><input type=submit onClick="copyFilePathData()" value='Update'></td>
  14.                             </form>
  15.                             <td width="5%" align="center"><a href='file:///<%=rst("ql_path")%>'>EDIT</a></td>
  16.                             <td width="5%" align="center"><a href="index.asp?mode=del_gl2&myguide=<%=rst("ql_guid")%>">DELETE</a></td></tr>                        
  17.             <%                    
  18.                 rst.movenext
  19.         wend
  20.  
The problem is that without a JavaScript function, this form will not keep the path for variable letter_path. I was told that I needed an onClick call to a basic JavaScript to keep the file path in the variable (FilePathData). Here is the script:

Expand|Select|Wrap|Line Numbers
  1. <script LANGUAGE="JavaScript">
  2. function copyFilePathData()
  3. {
  4.     do_list_update.filepath.value = do_list_update.letter_path.value
  5. }
  6. </script>
  7.  
So here is my problem: as you can see, given the loop nature of the form, its name changes. How can I properly modify this JavaScript to keep the file path? I cannot get the current script to work with the dynamic form name, leaving the variable letter_path with just the filename, minus the path.
Mar 6 '08 #1
3 3431
acoder
16,027 Expert Mod 8TB
Call the function by passing the form object:
Expand|Select|Wrap|Line Numbers
  1. <input type=submit onClick="copyFilePathData(this.form)" value='Update'>
Then change the function to this:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function copyFilePathData(frm)
  3. {
  4.     frm.filepath.value = frm.letter_path.value
  5. }
  6. </script>
  7.  
Mar 7 '08 #2
Thank you acoder! That did the trick.
Mar 7 '08 #3
acoder
16,027 Expert Mod 8TB
No problem, you're welcome. Post again if you have any more questions! Nobody's unimportant ;)
Mar 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jason | last post by:
Hi folks, I'm trying to create a section of a website with a unique file upload utility. The problem is that in most code and components I find to pass multipart/form data, you need to know the...
1
by: Dennis Gaida | last post by:
Hi there, I want to upload some exported reports to a FTP Server, for this I use a command line FTP utility. My Database sits in C:\Documents and Settings\Dennis\My Documents\Database The FTP...
1
by: SSW | last post by:
Hi! I want to include .JS(JavaScript file) to my aspx file. I used the following tag. <script language="javascript" src="Utility.js" type="text/javascript"> After compling my page and...
1
by: BW | last post by:
I am creating an upload/download function for an extranet site. Files will be uploaded to directory based upon the users login and associated project. The function works as long as I use "c:\Temp"...
1
by: lactaseman | last post by:
While I know this is not the correct venue... I realize this is of little to no importance to most out there... however, if I had found this in my initial searches, I would have used this. So, as...
0
by: microb0x | last post by:
Is there any difference in the way an Access .mdb file is launched from directly double-clicking the file through windows explorer versus using code within another Access file to launch the...
17
by: Paul | last post by:
On my development computer, I have virtual named host set up, like www.site1.lab. When I upload those to my web site for customer review under mywebsite.com/clients/site1/ it throws some of the...
2
by: Harmony504 | last post by:
I am passing a form field in JavaScript to a PHP function. The problem is when the parameter gets inside the PHP function the value is set to 1 when it should be a relative path to a file. ...
0
by: upadhyayanuj | last post by:
Hi I have an error while uploading file and then importing it into my sql table The process cannot access the file 'c:\inetpub\wwwroot\FlowLine\Excel File\Fan_Details.xls' because it is being...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.