Categories > TinyButStrong general >

selecting option list inside a block

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: TomH
Date: 2012-09-10
Time: 04:15

selecting option list inside a block

Hello
I need to "select" the appropriate item in an option list - which is inside of a block.
Trying to do this using "export" plugin to create a var that can then be used to check the item in the select list.

This is the block
<locs1>
<table>
<tr><td>Name:</td><td> <input type=text name='name' value='[active.name;block=locs2;export]'  size=29 maxlength=120></td></tr>
<tr><td>State:</td>
<td>
<select name='state'><option value='' > - - - - U.S. States - - - - </option>
<option value='AL' >Alabama</option>
<option value='AK' >Alaska</option>
<option value='AZ' >Arizona</option>
<option value='AR' >Arkansas</option>
<option value='CA' >California</option>
<option value='CO' >Colorado</option>
<option value='CT' >Connecticut</option>
<option>[active[[active.#;protect=no;]].state;ope=html;select]</option>
</select>
</td></tr>
</table>
</locs2>

As the block repeats I am seeing in the results in browser page source
for block #1
<option>[active[1].state;ope=html;select]</option>
and for block #2
<option>[active[2].state;ope=html;select]</option>
but as you can see the variable substitution is not taking place.


Can anyone see what's wrong with this?

Or is there a better/proper way to do this ???

Thanks for any ideas
TomH
By: TomH
Date: 2012-09-10
Time: 04:18

Re: selecting option list inside a block

Ooops typing error above
The opening block tag is actually/correctly in the code
<locs2>
<table>
<tr><td>Name:</td><td> <input type=text name='name' value='[active.name;block=locs2;export]'  size=29 maxlength=120></td></tr>
...

By: Skrol29
Date: 2012-09-11
Time: 11:22

Re: selecting option list inside a block


Why don't you replace
[active[[active.#;protect=no;]].state;ope=html;select]
with
[active.state;ope=html;select]

It may not work if the "state" column is not part of your recordset.
If it's so, we need to know where is stored the "state" information.
By: TomH
Date: 2012-09-11
Time: 13:19

Re: selecting option list inside a block

Dumb! That's the answer, just plain dumb.
Yes, state IS part of the dataset.
I allowed my self be lead astray by the "Examples" - which show the selecting being done with a var
So I worked at creating a var that would be present during onshow
But all the time the html plugin would actually accept the block value from the current record set.
Why is it that I forget the Prime TBS Golden Rule is "Just try the simplest solution!"

Thank you Skrol29

And thank you for TBS every day,
TomH