You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nägeli Margrit <ma...@ecofin.ch> on 2000/07/13 14:08:52 UTC

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 


Re: Pre-selected option in html form

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 14:08 +0200 13/07/00, Nägeli Margrit wrote:
>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.

I use this:

	<option value="blah" selected="selected">I'd like some Blah</option>
	<option value="noblah">No Blah thanks</option>

I believe this gets transformed to HTML by the HTMLFormatter, along with
other broken stuff like <br/> <hr/> <img/> etc.

There is an example of this sort of thing in sample that comes with FP TagLib.

    http://www.media.demon.co.uk/fp/fp.sit.bin      			(MacOS)
    http://www.media.demon.co.uk/fp/fp.zip                (WIN)
    http://www.media.demon.co.uk/fp/fp.tar.Z              (UNIX)

Hope this helps

Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: Pre-selected option in html form

Posted by Mac Schwarz <mc...@phil.uni-erlangen.de>.
Nägeli Margrit wrote:
> 
[...]
> 
> 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

Have you tried selected="selected" for the pre-selected option?

	Mac

-- 
Mac Schwarz / AERIA Projekt / Inst. f. Klassische Archaeologie
e-mail: mac@aeria.phil.uni-erlangen.de  / Tel.: 09131-85-24791
 FAU Erlangen-Nuernberg   /   Kochstr.4   /   91054 Erlangen
  <http://www.phil.uni-erlangen.de/~p1altar/aeriahome.html>

Re: Pre-selected option in html form

Posted by Jari Aarniala <ja...@ioboxgroup.com>.
----- Original Message -----
From: Nägeli Margrit <ma...@ecofin.ch>
To: <co...@xml.apache.org>
Sent: Thursday, July 13, 2000 3:08 PM
Subject: Pre-selected option in html form


: Valueless attributes are not allowed in xml, but the useragents cannot
tell
: the difference between selected="yes" and selected="no" yet.

I've just used something like selected="1", any value inside the quotes will
set it selected (apart from 'false' or '0' (zero)) I guess.

    Jari


Re: Pre-selected option in html form

Posted by sudhi <su...@insage.com>.
Hi,
I even I had the same problem with older version of cocoon. 
I am using selected="yes". And it works.
I am using Cocoon 1.7.4
~S

Nägeli Margrit wrote:
> 
> 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

Re: Pre-selected option in html form

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 13 Jul 2000, [iso-8859-1] N�geli Margrit wrote:

> 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?

sure. i use the empty string for the attribute value and things work
great - the html serializer drops the dummy attribute value when
appropriate. you can also do this:

<option>
 <xsl:attribute name="selected"/>
</option>

- donald