Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using PHP to pass a login form when required, and here is the code:

$htmlForm = '<form id="frmlogin">'.'<label>';
switch(LOGIN_METHOD)
{
    case 'both':
        $htmlForm .= $ACL_LANG['USERNAME'].'/'.$ACL_LANG['EMAIL'];
        break;
    case 'email':
        $htmlForm .= $ACL_LANG['EMAIL'];
        break;
    default:
        $htmlForm .= $ACL_LANG['USERNAME'];
        break;
}                       

$htmlForm .= ':</label>'.
             '<input type="text" name="u" id="u" class="textfield" />'.
             '<label>'.$ACL_LANG['PASSWORD'].'</label>'.
             '<input type="password" name="p" id="p" class="textfield" />'.
             '<center><input type="submit" name="btn" id="btn" class="buttonfield" value="Sign in to extranet" /></center>'.
             '</form>';

return $htmlForm;

The problem is, is that when the user hits enter in IE8, the form does not submit, and the user is forced to hit the submit button.

How do I rectify this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
449 views
Welcome To Ask or Share your Answers For Others

1 Answer

Also watch out for this fun fun bug:

I've learned the hard way that if your form is display:none at page load, even if you show it later with Javascript, IE8 still won't submit on enter. However, if it's not hidden at page load, and you set it to display:none after, like onDOMReady, then it works! WTF

More details and workaround here: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...