Using javascript to place focus to the name field of the logic form
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 28 Sep 2009 14:53:48 +0200
changeset 1165263ee1916e5
parent 115 6a80463a74c0
child 117 c1057591a344
Using javascript to place focus to the name field of the logic form
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt
     1.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt	Mon Sep 28 14:42:19 2009 +0200
     1.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt	Mon Sep 28 14:53:48 2009 +0200
     1.3 @@ -6,8 +6,13 @@
     1.4      <#if user?? >
     1.5        <meta http-equiv="REFRESH" content="1;URL=/">
     1.6      </#if>
     1.7 -  </head>
     1.8 -  <body>
     1.9 +    <script type="text/javascript">
    1.10 +        function setFocus() {
    1.11 +            var name = document.getElementById("name");
    1.12 +            name.focus();
    1.13 +        }
    1.14 +    </script>  </head>
    1.15 +  <body onload="setFocus();">
    1.16        <h1>${bundle.TITLE}</h1>
    1.17        <h2>${bundle.LOGIN}</h2>
    1.18  
    1.19 @@ -19,7 +24,7 @@
    1.20        <b>${message!""}</b>
    1.21  
    1.22        <form action="/login" method="post">
    1.23 -            ${bundle.NAME}: <input type="text" name="name"/>
    1.24 +            ${bundle.NAME}: <input type="text" name="name" id="name"/>
    1.25              ${bundle.PASSWORD}: <input type="password" name="password"/>
    1.26              <input type="submit" value="${bundle.LOGIN}"/>
    1.27        </form>