diff options
author | randomdan <randomdan@localhost> | 2010-11-06 21:37:22 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-11-06 21:37:22 +0000 |
commit | 6d82e5c68ddf5df12995d0c9245ea6233a2112d9 (patch) | |
tree | 82cf0e6bcf619cd3b7662442a0c8b71ec5ced1e7 | |
parent | Make the XML NS consistent (diff) | |
download | gentoobrowse-6d82e5c68ddf5df12995d0c9245ea6233a2112d9.tar.bz2 gentoobrowse-6d82e5c68ddf5df12995d0c9245ea6233a2112d9.tar.xz gentoobrowse-6d82e5c68ddf5df12995d0c9245ea6233a2112d9.zip |
Support form field autofocus and autofocus the search criteria box
-rw-r--r-- | gentoobrowse/form.xslt | 6 | ||||
-rw-r--r-- | gentoobrowse/present/search.xml | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gentoobrowse/form.xslt b/gentoobrowse/form.xslt index 14bd459..e24c8ae 100644 --- a/gentoobrowse/form.xslt +++ b/gentoobrowse/form.xslt @@ -19,6 +19,7 @@ <input> <xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> + <xsl:attribute name="id">form_<xsl:value-of select="@name" /></xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="dyn:evaluate(@xslvalue)" /> </xsl:attribute> @@ -36,6 +37,11 @@ </tr> </table> </form> + <xsl:if test="@autofocus != ''"> + <script type="text/javascript"> + document.getElementById('form_<xsl:value-of select="@autofocus" />').focus(); + </script> + </xsl:if> </xsl:template> </xsl:stylesheet> diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml index 716dc07..0c61f35 100644 --- a/gentoobrowse/present/search.xml +++ b/gentoobrowse/present/search.xml @@ -2,7 +2,7 @@ <view name="search" root="gentoo" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <project2:rawview> - <form caption="Search" submit="Search" action="/search" method="get"> + <form caption="Search" submit="Search" action="/search" method="get" autofocus="criteria"> <input type="text" caption="Criteria" name="criteria" xslvalue="/gentoo/project2:params/project2:param[@name='criteria']" /> </form> |