Enter doesn't act on form when cursor is on a drop down

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    Enter doesn't act on form when cursor is on a drop down

    Hi guys,

    Quick question.

    If I have a submit button (image type), and submits the form when I press enter from a text field, it should also work when the focus is on a select box?

    I'm running into that issue, just wanted to ask before I start debugging.



    Dan
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    confirmed: it doesn't work.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <body>
    
    Test Enter Key While Select Box is Focused:<br />
    
    <form action="" method="post" name="test">
    
    <input type="text" name="testText" value="Hi"/>
    <br /><br />
    <select name="testSelect">
    	<option value="1">One</option>
    	<option value="2">Two</option>
    	<option value="3">Three</option>
    </select>
    <br /><br />
    <input type="submit" name="submit" value="Submit"/>
    </form><br />
    
    <?php
    if(@$_POST['testSelect']) echo "<h2>Submited</h2>"; 
    ?>
    
    </body>
    </html>
    I have to use JavaScript and capture the enter key and submit the form and set all the settings (ie reset page num to 1, etc)...too much hassle for me. If the user is tabbing through or clicking, they can get to the Submit button.




    Dan

    Comment

    Working...