Topic Author
Posts: 2504
Joined: Wed Jan 05, 2000 3:11 am

E-Geeks: A Question About Java And/or Forms...

Tue Dec 21, 2004 6:42 am

This gets me. So there's this really ugly web page with a form on it, which does a dandy job of gathering information and sending it along. Now! When the user clicks the "submit" button (please don't everybody do it - I know the guy who has to read these submissions and he'll surely shoot on site) it goes to "thanks.htm" - but if you go to VIEW > CODE for the first page, no where on there does it say anything about "thanks.htm".

So the question is - how does it know to go to thanks.htm?, what if I wanted to make it go somewhere else (like, for example, a PDF file)?

Thanks to any contributors!
Topic Author
Posts: 2504
Joined: Wed Jan 05, 2000 3:11 am

RE: E-Geeks: A Question About Java And/or Forms...

Tue Dec 21, 2004 6:43 am

Oh, the reason I mention Java is because I was under the impression that had something to do with it.
Posts: 1923
Joined: Fri Apr 28, 2000 12:42 am

RE: E-Geeks: A Question About Java And/or Forms...

Tue Dec 21, 2004 6:46 am

When you click the Submit button, it triggers a call to a function nammed "return validate_form()" on the server. The redirection to the "thanks.htm" is done within that function, on the server side.
Never let the facts get in the way of a good theory.
Posts: 20713
Joined: Wed Jul 11, 2001 7:41 am

RE: E-Geeks: A Question About Java And/or Forms...

Tue Dec 21, 2004 7:43 am

Actually, the target page of a form is specified in the
element that opens the form in the HTML code.

In this case:

<form action="formpost.asp" method="POST" name="F1" language="JavaScript">

The emphasized parameter specifies that on submission of the form the browser will post the form data to the page formpost.asp. The code generating that page on the server (from the extension I suspect it´s a Windows server running "active server pages") will then process the form data and generate the confirmation page accordingly.

validate_form() is actually a JavaScript function which is not executed by the server (you won´t see any code in your browser in that case) but by the browser itself (that´s why you can see the code in the page source code). Something like that is often used to make a first local plausibility check on the browser side before bothering the server with an inconsistent reply. If it returns false, the follow-up page is not loaded (the form is not submitted) and the user has another chance to correct his input.

By the way: JavaScript has nothing to do with Java; The name JavaScript was merely chosen for marketing purposes. JavaScript is a browser-executed script language, Java is a portable compiled language usually employed for separate Applets or on the server side (not in this case, apparently).

And just for the record: JavaScript is entirely optional and in no way required for an HTML form or any other page. Pages should be constructed in a way that they will still work without JavaScript if at all possible. Since JavaScript is still somwhat browser-dependent, results will usually vary anyway, so it´s generally bad style to require the client to have it enabled.

Some browsers (hint! hint!) even have critical vulnerabilities in their JavaScript implementations, so forcing anyone to enable it is a safety issue as well.

In this case, the form should still work with JavaScript disabled; It just wouldn´t have that convenient plausibility-check.

[Edited 2004-12-20 23:56:31]

Who is online

Users browsing this forum: FAST Enterprise [Crawler], Google Adsense [Bot], LAX772LR, seb146, WarRI1 and 15 guests

Popular Searches On Airliners.net

Top Photos of Last:   24 Hours  •  48 Hours  •  7 Days  •  30 Days  •  180 Days  •  365 Days  •  All Time

Military Aircraft Every type from fighters to helicopters from air forces around the globe

Classic Airliners Props and jets from the good old days

Flight Decks Views from inside the cockpit

Aircraft Cabins Passenger cabin shots showing seat arrangements as well as cargo aircraft interior

Cargo Aircraft Pictures of great freighter aircraft

Government Aircraft Aircraft flying government officials

Helicopters Our large helicopter section. Both military and civil versions

Blimps / Airships Everything from the Goodyear blimp to the Zeppelin

Night Photos Beautiful shots taken while the sun is below the horizon

Accidents Accident, incident and crash related photos

Air to Air Photos taken by airborne photographers of airborne aircraft

Special Paint Schemes Aircraft painted in beautiful and original liveries

Airport Overviews Airport overviews from the air or ground

Tails and Winglets Tail and Winglet closeups with beautiful airline logos