473,548 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing File Path through JavaScript in an ASP Web Utility

2 New Member
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 3445
acoder
16,027 Recognized Expert Moderator MVP
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
NobodyImportant
2 New Member
Thank you acoder! That did the trick.
Mar 7 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
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
3626
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 number of files specified to upload. I'm trying to solve this by having one INPUT TYPE=FILE box, and, using javascript, each time someone selects...
1
15984
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 utility sits in C:\Documents and Settings\Dennis\My Documents\Database\oexport The files to be uploaded in C:\Documents and Settings\Dennis\My...
1
5973
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 executed in Browser, I get Error as below unable to find script library '/aspnet_client/system_web/1_0_3705_288/webUI_Validation.js". Try placing
1
2749
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" as the directory. When I use any other hard coded directory or even Server.MapPath() the upload function fails and returns the error: "Exception has...
1
3719
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 an alternative to the mentalis.org's IniReader, I submit the following files to the web news group DBs...: ...
0
1774
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 same file? Here is my situation: I have an application that when launched does a check whether or not
17
1677
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 source file references off and it does not work properly. My references are like: require_once($_SERVER."/utility/top.php");
2
1705
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. setup_config.php: <script language="javascript"> function install(){ ... Install.ExecuteDBScript(document.getElementById('path').value,...
0
1614
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 used by another process Now Some times its run successfully, i don't no how but somtimes it gives error, I figure out there is security issue of...
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7444
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7805
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5367
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

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.