Discussion Locked

ASP page with javascript and stored proc

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am really new to developing Active Server pages. I have beating my head against the wall for several days now. I have attemped and failed on every try based one the following information. I need to do the following: create a form to enter a reservation for a car rental shop. The page should validate the form using javascript and write the information to my database using the command object and my prepared stored procedure. The form needs to have a drop down list, 2-8 radio buttons and severaltext boxes. It should also have several links to other ASP's and outside web sites. My stored procedure fields are as follows: Renter_Name, Renter_Phone, Rental_Data, Pick_Up_Time (morning, afternoon, evening RADIO BUTTONS), Number_Days_Rented(DROPDOWN 1-5).
I am going to interface this with either SQL Server 7 or 2000. Many thanks in advance!!!

9 replies

by steved

You don't really give us very much to go on regarding what specific problems you're running into. Since I'm sure you don't expect someone to write the whole thing for you, my best suggestion is to get hold of one of the excellent ASP books that are available. They have many working examples of this sort of page. Two that I've found helpful are "Professional Active Server Pages" published by Wrox and "Using Active Server Pages" published by Que. There are plenty of others.

I hope this helps.
Steve Diamond

by anthonys

My main problem is that I am not sure if the Javascript and HTML would be "nested" within the ASP page itself or have an HTML form with the Javascript in it and then link to the ASP page to validate and submit it to the inout data. Thanks for the advice about the books though!

by steved

Either way will work. It's probably simpler to keep the page separate. Your form page can be pure HTML with client-side JavaScript for validation. Your FORM tag would look something like this:

by chrandrob

The way I generally prefer to do it is to have the javascript function on the same page as the HTML form. Instead of using a submit button or image, I use a regular button that calls a Javascript function. I usually call it validate(). Here's samplecode for the form:

Then here is a sample javascript routine to do validation:

by chrandrob

Post #2

You can set the form action to the same page or to another page. I use both ways equally. Send the values to your stored procedure and let it do all of the db work.

This discussion is closed to new replies.