forms and RETURN key

From: Date: Wed, 25 Apr 2001 15:57:48 +0000
Subject: forms and RETURN key
Groups: php.general 
Request: Send a blank email to php-general+get-50316@lists.php.net to get a copy of this message
I've observed a difference between how IE and NS interact with even simple forms. With IE, hitting the RETURN or ENTER key usually but not always triggers the submit button, but almost never with NS. Is this behavior controllable by my scripts? For example: <head><title>test form</title></head> <body> <?php if( $ok ) { echo "name1 is $name1\n"; echo "name2 is $name2\n"; } else { echo "<form action='$PHP_SELF' method=POST>\n"; echo "Name1:<input type='TEXT' name='name1'>\n"; #echo "Name2:<input type='TEXT' name='name2'>\n"; echo "<input type='SUBMIT' name='ok' value='ok'>\n"; echo "</form>\n"; } ?> </body> If I run this form using IE, hitting the Return/Enter key submits the form but the 'ok' variable is not set; it just redraws the form. If however, I uncomment the third echo line (the one for Name2), then hitting the Return/Enter key does have the desired effect in IE. In NS, the first version acts just like IE; the form redraws and that is all. But using the second variant with both text fields, hitting the Return key in NS does nothing at all. Is this just the way it is? :-( Or is this behavior controllable somehow? :-) --- Bill Rausch, Software Development, Unix, Mac, Windows Numerical Applications, Inc. 509-943-0861 bill@numerical.com

« previous php.general (#50316) next »