cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nägeli Margrit <margrit.naeg...@ecofin.ch>
Subject RE: Pre-selected option in html form
Date Thu, 13 Jul 2000 13:20:47 GMT
Big thanks to everybody who suggested a solution.

With your help, I solved it like this:

      <select name="{@id}" size="1">
        <xsl:for-each select="pf:option">
          <option value="{@value}">
            <xsl:if test="@selected='yes'">
              <xsl:attribute name="selected"/>
            </xsl:if>
            <xsl:value-of select="@value"/>
          </option>
        </xsl:for-each>
      </select>

This assumes that one of the options in the xml has ...selected="yes"

btw, the useragents I know can't tell the difference between selected,
selected="yes" or selected="no" or selected=0 - whenever the word "selected"
shows up, it's done and the rest is ignored.

Thank you all

maggie

-----Original Message-----
From: Gabriel Le Van [mailto:levan@arctis.com]
Sent: Thursday, July 13, 2000 2:14 PM
To: cocoon-users@xml.apache.org
Subject: Re: Pre-selected option in html form


I use xsl:attibute to check a radio button :

    <INPUT type="radio" name="{$champ}" onclick="{$onclick}"
value="{$value}">
     <xsl:if test="$readonly='true' or $showonly='true'">
      <xsl:attribute name="readonly">true</xsl:attribute>
     </xsl:if>
     <xsl:if test="$valeurChamp=$value">
      <xsl:attribute name="checked"/>
     </xsl:if>
     <xsl:if test="$tabindex">
      <xsl:attribute name="tabindex"><xsl:value-of
select="$tabindex"/></xsl:attribute>
     </xsl:if>
    </INPUT>



-----Message d'origine-----
De : Nägeli Margrit <margrit.naegeli@ecofin.ch>
À : cocoon-users@xml.apache.org <cocoon-users@xml.apache.org>
Date : jeudi 13 juillet 2000 13:52
Objet : Pre-selected option in html form


>I realise that my question is not directly cocoon-related, but seeing there
>are so many xsl experts on this list, I just go ahead and ask it anyway.
>
>I write a <form> which has a <select> element which contains various
><option> elements. One of these options (depending on selections in other
>screens or db output) has to be pre-selected. In html, this is done by
>specifying the valueless attribute "selected".
>
>Valueless attributes are not allowed in xml, but the useragents cannot tell
>the difference between selected="yes" and selected="no" yet.
>
>Has anyone encountered and solved this problem?
>
>Thank you
>
>maggie
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message