Categories > TinyButStrong general >

Select block doesn't show all options

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Martin
Date: 2005-03-09
Time: 14:24

Select block doesn't show all options

I have to use the following php and html to get a select list the shows all my products in the list. If I remove one
<option value="0">&lt;Select a product to display&gt;</option>
the list will show all products but the first one is not selectable. If I remove both
<option value="0">&lt;Select a product to display&gt;</option>
lines the first product is not shown? Can any one give me a clue?
This maybe a stupid question but I'am both new to php en tbs so bear with me...

html
<form action="[var..script_name]" method="get" name="form1" id="form1" onchange="submit()">
    <div align="center">Select a product to display:
        <select name="blk_list_product" class="normal" id="list_product>
            <option value="0">&lt;Select a product to display&gt;</option>
            <option value="0">&lt;Select a product to display&gt;</option>
            <option value="[blk_list_product.Id]">[blk_list_product.Name;block=option]</option>
        </select>
    </div>
</form>

php
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate("templates/selectproduct.htm") ;
$sql = new EsQuery;
$sql->getAllProducts();
$TBS->MergeBlock("blk_list_product",$db,$sql->sqlQuery) ;
$TBS->Show() ;
By: Skrol29
Date: 2005-03-10
Time: 00:42

Re: Select block doesn't show all options

Hello Martin,

What do you mean by "the first one is not selectable"?

Can you post the source of the form after the merge?
So I will be able to see what's happening.
By: Martin
Date: 2005-03-10
Time: 10:39

Re: Select block doesn't show all options

By the first one I mean the first product in the list. Below the 3 cases. I intentionally left the tags out.

Case1:
option value="[blk_list_product.Id]" [blk_list_product.Name;block=option]
Then the selection list will start with Selection2.

Case2:
option value="0" &lt;Select a product to display
option value="[blk_list_product.Id]">[blk_list_product.Name;block=option]
Then the selection list will start with Selection1. When I select Selection1 the $_GET variable is not updated (nothing happens).

Case3:
option value="0" &lt;Select a product to display
option value="0" &lt;Select a product to display
option value="[blk_list_product.Id]">[blk_list_product.Name;block=option]
Then the selection list will start with "Select a product to display".


Below the code from EI6 and Firefox101 the strange thing is that the Firefox version is missing the closing quote from the first option tag. I manually deleted a number of off option tags to prevent the text from becoming too long.

EI6
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ACM Research</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/acm.css" rel="stylesheet" type="text/css">
</head>
<body>

<form action="selectproduct.php" method="get" name="form1" id="form1" onchange="submit()">
    <div align="center">Product: &nbsp;
        <select name="blk_list_product" class="normal" id="list_product>
            <option value="0">&lt;Select a product to display&gt;</option>
            <option value="0">&lt;Select a product to display&gt;</option>
            <option value="12">Selection1</option>
            <option value="25">Selection2</option>
            <option value="9">Selection3</option>
            <option value="16">Selection4</option>
        </select>
    </div>
</form>

</body>
</html>

Firefox101
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/acm.css" rel="stylesheet" type="text/css">
</head>
<body>

<form action="selectproduct.php" method="get" name="form1" id="form1" onchange="submit()">
    <div align="center">Product: &nbsp;
        <select name="blk_list_product" class="normal" id="list_product>
            <option value="0>&lt;Select a product to display&gt;</option>
            <option value="0">&lt;Select a product to display&gt;</option>

            <option value="12">Selection1</option>
            <option value="25">Selection2</option>
            <option value="9">Selection3</option>
            <option value="16">Selection4</option>
        </select>
    </div>
</form>

</body>
</html>

Another thing (slightly off-topic) is that when I select a option from the list in Firefox the URL is correctly updated with ..?blk_list_product=12 and the $_GET variable is updated, but in IE nothing happens?
By: Skrol29
Date: 2005-03-10
Time: 16:25

Re: Select block doesn't show all options

Hello,

I'm sorry, I still don't understand what you mean by "is not selectable".
When I copy you Html result into a file, I can select items of the list.

The result of the merge cannot be different between IE and FireFox, unless some parameters are given differently to the PHP script from those two  navigators. The Html source is given to the navigator, not produced by the navigator.

Your problem comes probably from a part of your JavaScript code (this could explain a difference between IE and FF) or your PHP code that you haven't posted yet.
By: Martin
Date: 2005-03-10
Time: 18:06

Re: Select block doesn't show all options

During the setup of  another example to show you what went wrong I found my error. I seems to happen when a id= with a wrong name is used in the select tag.

Thank you for your response.