PDA

View Full Version : I think this is a javascript issue



paulhicks
Jun 27th, 2005, 07:40 AM
I'm working on 2 seperate forms on the website:

www.suncom.com.au

There are 2 links there

- Sales Enquiry Form
&
- Service Request Form

It seems that the 'Service Request Form' when clicking submit brings up an alert if all mandatory fields aren't filled in, then you click 'OK' and your back to the form.

But on the 'Sales Enquiry Form' if you submit the form and the mandatory fields aren't filled in you are taken to a different page and when you go back the form has been cleared.

I can't see why this is happening, I didn't create the form I have just made cosmetic changes to it.

I need to find out how to make the 'Sales Enquiry Form' bring up an alert, or if it takes you to another page, when you go back the form hasn't been cleared.

It's fine to test and submit the form if you like.

:o Also is there a way to make my 'Print Form' button check if mandatory fields are filled in before printing aswell ? (not that important yet)

The form has been written using frontpage, and the code is a bit of a mess to me. Maybe it's better to create new forms from scratch, I know very little about javascript though.


Hope you can understant the babble
Paul

nikkiH
Jun 27th, 2005, 01:36 PM
An alert happens client-side. The form is never submitted. Thus, values remain in place.
If the form gets submitted, THEN validation happens, in order to retain form fields, the server-side code must re-write them back in, usually by using the original parameters via GET or POST. Or the user hits BACK and their browser keeps the fields for them (don't count on that; not all do).