#!/usr/local/bin/perl use CGI qw(:standard); ############################################### # # File: greet.cgi # # Displays a form for input of the students # choice of database. Send info to file getDigLib.cgi # # ################################################# print header(); $JSCRIPT=<<eos; function validateForm() { if (document.form1.Student.value == 'My Name') { alert("Don't forget to enter your name!"); document.form1.Student.focus(); document.form1.Student.select(); return false; } if (document.form1.Library.value == 'Library') { alert("Don't forget to enter your library!"); document.form1.Library.focus(); document.form1.Library.select(); return false; } return true; } eos print start_html(-script=>$JSCRIPT), h2("Register your choice of library on the Web"), start_form(-method => "post", -action => "getDigLib.cgi", -name=>'form1', -onsubmit=>'return validateForm()'), "Your name is ", textfield(-name=>'Student', -value=>'My Name', -size=>50, -maxlength=>80), p, "Your library catalog is ", textfield(-name=>'Library', -value=>'Library', -size=>80), p, submit(-value=>'Enter your data'), reset('Reset'), end_form(), end_html();