Mercurial > dive4elements > gnv-client
changeset 414:59c6c7b62e43
Automatically select entry in multi select boxes if there is only one entry to avoid input failures.
gnv/trunk@636 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 27 Jan 2010 13:26:02 +0000 |
parents | 0ce07c6e132c |
children | 9f4a0b990d27 |
files | gnv/ChangeLog gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Mon Jan 25 14:53:38 2010 +0000 +++ b/gnv/ChangeLog Wed Jan 27 13:26:02 2010 +0000 @@ -1,3 +1,10 @@ +2010-01-27 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Added a + workarround to avoid input failures caused by multi select boxes with only + one entry. They look like text input fields and don't force the user to + select a row. In this case, the single entry is selected automatically. + 2010-01-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/webapp/styles/default.css: Added a class for dynamic tables
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Mon Jan 25 14:53:38 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Wed Jan 27 13:26:02 2010 +0000 @@ -26,6 +26,11 @@ <legend><xsl:value-of select="xform:label"/></legend> <xsl:choose> + <xsl:when test="$items = 1"> + <select name="{$selectName}" multiple="multiple" size="{$items}"> + <xsl:apply-templates mode="selected"/> + </select> + </xsl:when> <xsl:when test="$items < 5"> <select name="{$selectName}" multiple="multiple" size="{$items}"> <xsl:apply-templates/> @@ -58,6 +63,15 @@ </xsl:template> + <xsl:template match="xform:item" mode="selected"> + <xsl:variable name="optionValue" select="xform:value"/> + <option value="{$optionValue}" selected="selected"> + <xsl:value-of select="xform:label"/> + </option> + </xsl:template> + + + <xsl:template match="xform:group"> <legend> <xsl:value-of select="xform:label"/>