Dear Dr. Website®: I am creating a search engine site using Perl. I know that 90 percent of servers are Unix-based; however,
I use Win98 and want to test the program before uploading it to the site. I have ActivePerl517, I don't know how to test it on my PC.
Do you just call up the file name with the browser (ex. C:/my.website.html) as you would with an HTML file? How does the browser recognize the Perl programming language on my PC only?
Even if you were running a server on your machine that could recognize Perl,
such as Microsoft's Personal Web Server, Perl that's written to be used on a Unix server is not exactly the same as that written for a Windows machine. You would have to convert the Perl to work on a Windows machine, you'd need Perl to be installed on your machine, and you'd have to configure the Web server that is running on your machine to recognize Perl.
In short, you can't run valid tests without some additional work.
However, if you install Perl on your PC, you can test Perl programs in standalone mode by running them via double-clicking as usual, or calling them from the command line, something like:
C:/Perl/Perl.exe myprog.pl
Dear Dr. Website®: I'm a Web applications designer, and I have one thing that is driving me crazy! That's people who get in a hurry and click the Submit button multiple times in succession, like they think it will let the computers know that they are in a hurry or something. Do you know of any way to stop this?
When Dr. Website is stumped, he knows what specialist to call on!
In this case, it's Ronnie Moore, Managing Editor of JavaScriptSource.com, who gave this diagnosis:
The first, and easiest, thing to do is to add an alert() message right before the form returns true; (you are using onSubmit() with field validation, right?) This way, before the submission is sent, users have to click "OK." They aren't as likely to click again after the alert box says it's been done (or after they have moved their mouse to the OK box-which is not to say they wouldn't click ENTER).
Second, you might want to add a reset() onLoad event handler to the BODY tag that will reset each entry field to "" if they submit the form, hit Back, and try to do it again. It would clear the fields when the page loads again. People would tend not to reenter all the data.
But for a more thorough solution, we have put together a little script appropriately called "Only Submit Once." It's just a normal HTML form, with some basic field validation and submitcount checking. You can see it online at http://javascript.internet.com/forms/submit-once.html.
To test it, try submitting the form (you will have to enter data in each field), then hit "ESC" right after the alert box pops up, to stop the submission. Then, try clicking the Submit button again. Voila!
The idea behind it is this: A variable called submitcount stores a value of 0 when the page is loaded
-- it is set to 0 because no forms have been submitted.
When the form is submitted, the checkFields() function is called and scampers off to run some basic field validation. If all the fields validate (well...if they aren't empty), program flow comes to a nested "if...else" statement that does this:
If submitcount == 0
(a double == to test for equality, not a single = to set a value), which means that the form has not been submitted yet, and since everything validated above, it "returns true," allowing the form to submit. Right before the return true, we add 1 to the submitcount variable with submitcount++; (so now submitcount = 1).
If the user clicks again, and everything validates as normal at the top, this time in the nested "if...else," submitcount won't be equal to 0, and the else statement will run an alert message saying the form has been submitted and a "return false" to cancel the form submission.
Dear Dr. Website®: I have seen banner ads that provide a text box for user input and a submit button. How is that done?
Most of the banner ads you see that use an input box
and a submit button are actually created with HTML. Here is an example that we use for the WDVL (Web Developer's Virtual Library):
<CENTER>
<form method=post action="http://e-newsletters.internet.com/cgi-bin/newslinx.form">
<TABLE WIDTH="468" CELLPADDING="0" CELLSPACING="0" BORDER="0" BGCOLOR="#660000" ALIGN="CENTER">
<TR>
<TD COLSPAN="3"><IMG alt="" SRC="t.gif" WIDTH="1" HEIGHT="1"></TD>
</TR>
<TR>
<TD><IMG ALT="" SRC="t.gif" WIDTH="1" HEIGHT="58"></TD>
<TD>
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="466" bgcolor="#ffffee">
<TR>
<TD ALIGN="CENTER">
<A HREF="http://e-newsletters.internet.com/wdvl.html">
<IMG SRC="wdvl-microscott.gif" ALT="Free Newsletter!" WIDTH="58" HEIGHT="40" BORDER="0">
</A><BR><FONT FACE="Geneva, Arial, sans-serif" SIZE=-2>NEWSLETTER</FONT>
</TD><TD>
<FONT FACE="monospace" SIZE="1">
<INPUT TYPE="hidden" NAME="List_Name" VALUE="WDVL">
<INPUT STYLE="font-size:9pt;font-family:monospace;" TYPE="text" NAME="Email_Address" SIZE="8" VALUE="e-mail">
<INPUT TYPE="hidden" NAME="Action" VALUE="subscribe"><BR>
<INPUT STYLE="font-size:9pt" TYPE="submit" NAME="Subscribe" VALUE="Subscribe">
<input TYPE=Hidden Name="LAST" Value="THE_END">
</FONT>
</TD>
<TD><IMG ALT="" SRC="t.gif" WIDTH="5" HEIGHT="58"></TD>
<TD VALIGN="TOP"><FONT FACE="Geneva, Arial, sans-serif" SIZE=-1>What's new on the WDVL:</FONT><BR>
<FONT FACE="Geneva, Arial, sans-serif" SIZE="1">
<SPAN STYLE="text-decoration:none;color:blue;font-size:9pt;font-weight:normal;font-style:normal;font-family:Geneva, Arial, sans-serif;line-height:100%">
<a class="headlines" TARGET="_top"
href="http://wdvl.internet.com/Authoring/Languages/XML/XHTML/">Introduction to XHTML, with eXamples</a><BR>
<a class="headlines" TARGET="_top"
href="http://wdvl.internet.com/Authoring/HTML/Validation/validate.html">Is It Valid, or Is It Not?</a><BR>
<a class="headlines" TARGET="_top"
href="http://wdvl.internet.com/Authoring/Languages/Perl/PerlfortheWeb/index2.html">The Perl You Need to Know, Part 2</a><BR>
</SPAN>
</FONT>
</TD>
</TR>
</TABLE></TD>
<TD><IMG ALT="" SRC="t.gif" WIDTH="1" HEIGHT="1"></TD></TR>
<TR><TD COLSPAN="3"><IMG ALT="" SRC="t.gif" WIDTH="1" HEIGHT="1"></TD>
</TR>
</TABLE>
</FORM>
</CENTER>