Help Desk
By Jerry Lee and Kenny Shi, Guest Editors
Forms with Function
Dear Help Desk,
I am using FrontPage 2000 to create a Web site where a user can input data into a form that will be stored in the database. I want to allow the user to upload a small JPEG file at the same time. The code would also store a unique name for the JPEG in the Access database along with other data on the form. That way, when other users retrieve records they'll get reports with the correct pictures attached. I can get FrontPage to load form-based data and I can use SA-FileUp to upload the JPEG on a separate form, but I cannot get them working together. Do you know a way to do this?
- Daniel
Dear Daniel,
The workaround is to create two separate forms (for example, Data and Upload) on the same HTML page that take data and files separately. Write a JavaScript function so that when the user fills out the form and uploads the file, it grabs the Data form's elements and places them into hidden form elements in the Upload form. Then have SA-FileUp handle the upload, and repost the form to itself. The form page gets the repost data and populates it into form components. The structure looks like this:
<HTML> <body> ....
<%if [From File-Upload repost] Then
populate the fields
user_id = Request("user_id")
...
end if%>
<form name="Data"
action="FormHandler.asp"
method="Post">
<input type=text name="user_id"
value="<%=user_id%>">
...
</form>
<form name="Upload"
action="SA-FileUp"
method="Post"
onSubmit="populateForms()">
<input Type=File ..