View Full Version : ASP/HTmL

08-12-2005, 10:13 PM
I have an asp page that has a form for adding a record to a SQL database. I have javascript to ensure that the require fields are inputted. I have a vbscript to ensure that the record to be added does not already exist. When I try to enter an existing record, I want the html page to re-appear with the data entered on it so the user does not have to re-enter the data and only has to change what has to be changed to get the record added. How do I do that?? Any help??

08-12-2005, 11:12 PM
You'd have to re-write out the form with values entered.

myVar = Request.Form("var")

<input type="text" name="whatever" value="<%=myVar%>">

08-13-2005, 01:59 AM
Hi buddyref and welcome to the board!

www.asp101.com/samples has some good database examples such as one called Database Editing.

08-13-2005, 08:05 PM
Post the form back onto itself, place a majority of the code in sub routines. Then when the page loads you look to see if the form was posted back onto itself, if not you display the form if yes you process the form, this way if there are any errors or if there is duplicated data you can halt execution and call the form with the data filled in. An example of this is posted on my site and available for download as a .zip file at http://www.dataconnective.net/samples/classicasp.asp