Sponsor Message:
Non Aviation Forum
My Starred Topics | Profile | New Topic | Forum Index | Help | Search 
E-Geeks: A Question About Java And/or Forms...  
User currently offline747-600X From United States of America, joined Jan 2000, 2829 posts, RR: 13
Posted (11 years 5 months 1 week 5 days 7 hours ago) and read 3593 times:

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!

3 replies: All unread, jump to last
User currently offline747-600X From United States of America, joined Jan 2000, 2829 posts, RR: 13
Reply 1, posted (11 years 5 months 1 week 5 days 7 hours ago) and read 3585 times:

Oh, the reason I mention Java is because I was under the impression that had something to do with it.

User currently offlineQb001 From Canada, joined Apr 2000, 2053 posts, RR: 4
Reply 2, posted (11 years 5 months 1 week 5 days 7 hours ago) and read 3586 times:

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.
User currently offlineKlaus From Germany, joined Jul 2001, 21652 posts, RR: 53
Reply 3, posted (11 years 5 months 1 week 5 days 6 hours ago) and read 3575 times:

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]

Top Of Page
Forum Index

This topic is archived and can not be replied to any more.

Printer friendly format

Similar topics:More similar topics...
Question About Squadrons And Divisions. posted Thu Mar 20 2003 07:20:45 by BO__einG
Question About English Football Leagues And Cups posted Thu Mar 10 2005 09:38:10 by HercTech
Question About The Lexus IS300 And Toyota Supra posted Mon Jul 15 2002 05:14:32 by Planelover
Odd Question About Cell Phones And Driving posted Wed Apr 24 2002 04:58:57 by AA61hvy
Question About Using Neutral In Automatic Car posted Sun Nov 26 2006 04:33:47 by Tu204
Question About Verdict Saddam posted Sun Nov 5 2006 16:03:57 by FJWH
Question About Visiting Israel posted Tue Oct 31 2006 22:15:44 by Springbok747
UK: Question About Post Offices posted Wed Oct 18 2006 22:55:05 by 9V
Question About Slot Machines posted Wed Oct 18 2006 03:35:57 by Derico
Question About Updating My Windows posted Mon Oct 16 2006 06:41:00 by STLUAL747