[Zope] Setting SELECTED in select box

Laurie Nason laurien@tiger.bcm.tmc.edu
Tue, 8 May 2001 08:59:52 -0500


Have you tried checking to see if one of your 27's is a string and one is a 
number? I seem to remember that I had this problem before, if I find it I 
will let you know

BTW - you could make the Selected a little snazzier by doing the 
following.... saves on a few if statements

SELECT NAME="fileid" SIZE="1">
	<OPTION VALUE="0">-- Select mediafile --</OPTION>
	<dtml-in sqlGetMediafiles>
	    <dtml-if fileid>
		<OPTION VALUE="<dtml-var id>" 
			<dtml-if expr="fileid == id">SELECTED></dtml-if>>
				<dtml-var filename></OPTION>
	    </dtml-if>
	</dtml-in>
</SELECT>	

HTH Laurie

On Tuesday 08 May 2001 08:45, Gitte Wange wrote:
> No no ...
> It insert the correct id ... I can see that in the html-source ...
> so that's not the problem.
>
> What makes me wonder is that even though there is an id=27 and a fileid=27
> it does set this as SELECTED ... why ?
>
> Gitte
>
> On Tuesday 08 May 2001 15:39, you wrote:
> > Hi Gitte,
> >
> > bad idea to use "id" for this, you are probably running into
> > a namespace-problem.
> >
> > To check this, just give out the content of "id" with
> > <dtml-var id>
> >
> > id is probably the id of your document or folder.
> > Try to find an other identifier which is not used by zope itself.
> >
> > Regards
> > Tino Wildenhain
> >
> > --On Dienstag, 8. Mai 2001 14:48 +0200 Gitte Wange <gitte@mmmanager.org>
> >
> > wrote:
> > > Hello,
> > >
> > > I have run into this weird problem:
> > > I am trying to set an option in a select box SELECTED in the id of the
> > > option  is the same as the value of the select box.
> > > The code looks like this:
> > >   <SELECT NAME="fileid" SIZE="1">
> > >    <OPTION VALUE="0">-- Select mediafile --</OPTION>
> > >   <dtml-in sqlGetMediafiles>
> > >   <dtml-if fileid>
> > >    <dtml-if expr="fileid == id">
> > >    <OPTION VALUE="<dtml-var id>" SELECTED><dtml-var filename></OPTION>
> > >    <dtml-else>
> > >    <OPTION VALUE="<dtml-var id>"><dtml-var filename></OPTION>
> > >    </dtml-if>
> > >   <dtml-else>
> > >    <OPTION VALUE="<dtml-var id>"><dtml-var filename></OPTION>
> > >   </dtml-if>
> > >   </dtml-in>
> > >   </SELECT>
> > >
> > > Now when I have selected a file, I can see that the fileid variable is
> > > set. Well then the select box should select the file that has that id
> > > right?
> > >
> > > But it doesn't - it doesn't select anything.
> > >
> > > Can anyone help me?
> > >
> > > Regards
> > > --
> > > ************************
> > > Gitte Wange Jensen
> > >
> > > System Squid Developer
> > > MMManager Aps
> > > +45 29 72 79 72
> > >
> > > gitte@mmmanager.org
> > > ************************
> > >
> > > _______________________________________________
> > > Zope maillist  -  Zope@zope.org
> > > http://lists.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists -
> > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > >  http://lists.zope.org/mailman/listinfo/zope-dev )
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
_________________________________________________
National Center for Macromolecular Imaging
Baylor College of Medicine
Houston, TX
_________________________________________________