[Zope] Setting SELECTED in select box
Thomas B. Passin
tpassin@mitretek.org
Tue, 8 May 2001 10:43:30 -0400
There is a productive way to approach problems like this - where the problem
might be an HTML issue or it might be a Zope issue. It's better if you go
through this process before asking for help. You will learn more, create
less noise on the list, and get more accurate help with fewer back-and-forth
questions and answers.
1) Make sure you know the correct HTML syntax and that you understand how
the HTML is supposed to work.
- Handcode an example of the html and get it to work in the browser.
Make it as SIMPLE as possible. Get a good HTML reference, perhaps the
HTML Reference Library (search on line for it).
2) Now change your HTML sample so it contains values similar to those you
expect to get from Zope. Keep it as SIMPLE as before. Make sure it still
works in the browser.
3) Now use Zope to create an HTML page as much like your hand-crafted sample
as possible.
- Check to see if it works in the browser.
- Look at Zope's HTML and see if it matches your example. This
should be easy if you have SIMPLIFIED the example.
By now, either you have fixed the HTML or you know it's something about Zope
or HTML that you don't quite understand, and you know which one is the
problem. Now you may be ready to ask for help. When you ask for the help,
be concise and specific. Use your simplified example. For instance:
"I want to produce THIS HTML. My Zope code is HERE, but it
produces THIS RESULT instead. The problem seems to be in the <whatever
part>.
How can I produce my HTML?"
Or
"I want to produce this result with HTML. I expected that THIS HTML
CODE
would work, but it does THIS instead. How should I change my HTML
to do what I said I want?"
(If it's really an HTML problem, though, this list isn't the place for
it)
In your case, Gitte, you should make sure that you have a sample of HTML
that selects the correct option when the page loads. You don't even need
Zope for that. Then make sure that Zope is really giving you the correct
values in its output, so that it reproduces the HTML that you know works.
If you have already done this, you should say so in your post.
Cheers,
Tom P
[Gitte Wange]
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.