http://qs1969.pair.com?node_id=1062729


in reply to Re^2: How to deal with multiple functions served from only one input field?
in thread How to deal with multiple functions served from only one input field?

Sadly. Entering a domain name in the top field, and hitting enter, does nothing. It doesn't even post a query. However. If I comment out the ip text field, and try it again. It works. ???

If you add a submit button, then Enter will submit the form even if there are multiple text inputs, at least in Firefox 25.0 (the only browser I tested). Without a submit button, Enter submits the form only if there is a single text input but doesn't submit the form if there are multiple text inputs.

The following works for me:

#!/strawberry/perl/bin/perl.exe use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::Whois::Raw; use Net::Whois::ARIN; $Net::Whois::Raw::OMIT_MSG = 1; $Net::Whois::Raw::CACHE_TIME = 1; $Net::Whois::Raw::TIMEOUT = 8; my $q = new CGI; my $domname = $q->param("domname"); my $ip = $q->param("ip"); print "content-type:text/html; charset=utf-8\n\n"; print qq(<!DOCTYPE html> <head><title>igwhois</title></head><body>); print qq( <form method="post"> <fieldset> <label for="domname">Domain: </label><input type="text" name="domn +ame" /><br /> <label for="ip">IP: </label><input type="text" name="ip" /> </fieldset> <input type="submit" value="Submit"> </form> ); if (!$domname) { print ""; } else { my $text = get_whois($domname, undef, "QRY_LAST"); print qq(<pre>); print $text; print qq(</pre>); } my $w = Net::Whois::ARIN->new( host => 'whois.arin.net', port => 43, timeout => 30, ); if (!$ip) { print ""; } else { my $text = $w->query("n + $ip"); print qq(<pre>); print $text; print qq(</pre>); } print qq(</body></html>);