|
A c t i o n f o r L i b r a r i e s
— J u n e 2 0 0 2
The Internet ConnectionBy Michael Sauers and Ellen Fox
Do Your Online Forms Still Work? For example, the new domain for the Kansas State Library is kslib.info. Although the Web site still works under the old .ks.us domain, all staff e-mail addresses at the state library have switched to the new domain. It's the .info that led us to discover a small problem in the online forms on BCR's Web site. When a user from the Kansas State Library filled out one of our Web-based forms, the processing script (a modified version of the widely available FormMail script) insisted that the e-mail field had been left blank, regardless of the fact that the field had been filled in correctly. After some investigation it turned out that BCR's script, written in Perl, contained the following line of code: $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) Without going into the intricacies of Perl, the problem was the following bit: {2,3} This script checks the TLD of the submitted e-mail address. If the address has less than two or more than three characters it is considered invalid. Therefore, the form would not accept the .info e-mail address. Although this check used to be true, it is no longer. To solve this problem, we changed the offending code to read: {2,10} This allows for a TLD as short as two characters and as long as 10. Problem solved. (Why so long? Well, .museum is coming; that's six characters, so we just decided to play it safe and allow for 10.) Since a large number of forms contain some type of e-mail validation, either in Javascript, Perl or another scripting language, this problem may strike your library's Web site. A few popular Javascript e-mail validation scripts simply check for a minimum number of characters rather than a maximum; these scripts should be unaffected. Next Article | Previous Article | Table of Contents | BCR Publications Comments to:
shoffhin@bcr.org |