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:
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:
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.
Code:
while not rst.EOF %> <input type=hidden name=letterid value=<%=rst("ql_guid")%>> <tr bgcolor=<%=bgcolor%>> <form name=do_list_update&mycount action=index.asp method=post> <input type=hidden name=mode value='update_list'> <input type=hidden name=myguide value='<%=rst("ql_guid")%>'> <input type=hidden name=filepath value=""> <td width="20%"><input name=letter_name value='<%=rst("ql_name")%>' size=25></td> <td width="40%"><%=rst("ql_path")%></td> <td width="20%"><input type=file size=30 name=letter_path value=<%=Request("filepath")%>></td> <td width="10%" align="center"><input type=submit onClick="copyFilePathData()" value='Update'></td> </form> <td width="5%" align="center"><a href='file:///<%=rst("ql_path")%>'>EDIT</a></td> <td width="5%" align="center"><a href="index.asp?mode=del_gl2&myguide=<%=rst("ql_guid")%>">DELETE</a></td></tr> <% rst.movenext wend
Code:
<script LANGUAGE="JavaScript"> function copyFilePathData() { do_list_update.filepath.value = do_list_update.letter_path.value } </script>
Comment