Categories > TinyButStrong general >

ope=html and blocks

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Will Torres
Date: 2006-07-31
Time: 04:22

ope=html and blocks

Hi,

I've been using tinybutstrong for a while now.  I really like the bmagnet feature.

I have a problem where the plugin to select an option in a select (ope=html;select) does not work within a block.

In this template, "myname" is filled-in correctly, but "myid" fills in as "".
<form name="f[r.$;block=form]">
..
  <select name="myid">
    <option value="[r.myid;noerr;ope=html;select]">[r.myname;noerr]</option>
    <option value="[list.list_id;block=option]">[list.list_name;noerr]</option>
  </select>
..
</form>


Now This form worls:
<form name="r[r.$;block=option]">
  <select name="myid">
    <option value="[var.this_id;noerr;ope=html;select]">[var.this_name;noerr;magnet=option]</option>
    <option value="[list.list_id;block=option]">[list.list_name;noerr]</option>
  </select>
</form>


In the second form, var.this_id gets replaced correctly, but its also set manually to the first element of "$r".
Both will generate the correct block sequence for "list.list_id" and "list.list_name."


Please fix.

Thank you,

Will Torres
By: Skrol29
Date: 2006-07-31
Time: 16:59

Re: ope=html and blocks

Hi Will,

I can reproduce your problem. In fact, it happens when the value to select is not in the list. Then TBS add a blank option at bottom of the <option> list. If the value is in the list, all is ok. I'll see deeper this problem which seems to be a bug and I'll give news.
By: Skrol29
Date: 2006-08-03
Time: 18:55

Re: ope=html and blocks

Hi Will,

I'm about to send an update for the HTML plug-in. Would you like to test it before ?
By: Will Torres
Date: 2006-08-03
Time: 20:40

Re: ope=html and blocks

yeah
By: Will Torres
Date: 2006-08-08
Time: 06:20

Re: ope=html and blocks

it doesnt work :(

<select name="status">
                 <option value="[r.status;noerr;ope=html;select]"> [r.status_name;noerr;ifempty='-- none --']</option>
                 <option value="[statuses.id;block=option;bmagn
et=option]">[statuses.name;noerr]</option>
               </select>

if r.status is in statuses (as id, then it never adds the select directive.
if r.status is not in statuses (as id), then it displays the "-- none --" with value=""
By: Skrol29
Date: 2006-08-08
Time: 18:11

Re: ope=html and blocks

The following works for me.
HTML:
<form name="f[r.$;block=form]">
  <select name="status">
    <option value="[r.status;noerr;ope=html;select]">
      [r.status_name;noerr;ifempty='-- none --']</option>
    <option value="[statuses.id;block=option;bmagnet=option]">
      [statuses.name;noerr]
    </option>
  </select>
</form>

PHP:
<?php

include_once('tbs_class.php');
include_once('tbs_plugin_html.php');

$list = array();
$list[] = array('id'=>'28', 'name'=>'List A');
$list[] = array('id'=>'29', 'name'=>'List B');
$list[] = array('id'=>'30', 'name'=>'List C');
$list[] = array('id'=>'31', 'name'=>'List D');

$r = array();
$r[] = array('status'=>31,'status_name'=>'List Dx');
$r[] = array('status'=>32,'status_name'=>'List Ex');

$TBS = new clsTinyButStrong;

$TBS->LoadTemplate('test.htm');
$TBS->MergeBlock('statuses',$list);
$TBS->MergeBlock('r',$r);
$TBS->Show();

?>
By: rein
Date: 2006-12-20
Time: 10:15

Re: ope=html and blocks

I currently have the same problem and the above code doesn't seem to fix it.

If in your code you change this
$r = array();
$r[] = array('status'=>31,'status_name'=>'List Dx');
$r[] = array('status'=>32,'status_name'=>'List Ex');

to a more logical example
$r = array();
$r[] = array('status'=>31,'status_name'=>'List D');
$r[] = array('status'=>32,'status_name'=>'List E');

Now I would expect the first status 31-D to be in the list ONCE, because I should have A, B, C, D where D should be selected.
Instead, when I try this, the list consists of D, A, B, C, D, where the last D is selected (this seems to work)