Categories > TinyButStrong general >

ope=html;select - but nothing selected

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Olifants
Date: 2007-05-24
Time: 21:47

ope=html;select - but nothing selected

Hi!

On my system is installed

phpversion: 5.1.4

TinyButStrong version 3.2.0 for PHP 5
Installed plug-ins: 0

So I don't know why it won't work.
In my form I want to mark as 'selected' the item the user has selected in the last turn:

include_once ('../tbs/tbs_class_php5.php');
include_once('../tbs/tbs_plugin_html.php');
$brand    = $_GET['brand'];
...
while ($row = $getMenue->queryResult()) {
    $selectedItem = $brand == $row['brand'] ? $row['brand'] : $defBrand;
    $menueLoop[] = array('pointVal' => $row['brand']);
}
...

...
<form action="[var.phpFile]" method="get" enctype='multipart/form-data'>
    <select name="brand" size="1">
        <option>[menueLoop.pointVal;block=option]</option>
        <option>[var.selectedItem;ope=html;select]</option>
    </select>
    <input type="submit" name="doSearch" value="Start search"/>
</form>
...
By: Skrol29
Date: 2007-05-24
Time: 23:58

Re: ope=html;select - but nothing selected

Hi,

In your script, $selectedItem is true or false, while it should be the value to select in the list.
By: Olifants
Date: 2007-05-25
Time: 10:01

Re: ope=html;select - but nothing selected

Damned! I found the error and it was truly not in the tbs (great template!). It was in my chaotic head!
Inside the 'while' I use the short syntax instead of the good old
'if' to set the 'selectedItem' so it will always be the same value.

Very sorry to waste your time

Ronny