Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: ASP/HTmL

  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP/HTmL

    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??

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    You'd have to re-write out the form with values entered.

    myVar = Request.Form("var")
    ...

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

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Hi buddyref and welcome to the board!

    www.asp101.com/samples has some good database examples such as one called Database Editing.
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #4
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,068
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •