Categories > TinyButStrong general >

Retrieve or hightlight the dropdown selected values

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Suneel Kumar
Date: 2013-09-09
Time: 12:01

Retrieve or hightlight the dropdown selected values

I am trying to submit a form with a multiple drop down values selected and trying to capture the same values in the next page form.

<form name="form1">
<select name="color[]" multiple="multiple" id="color" size="4">
                    <option value="c1">red</option>
                    <option value="c2">yellow</option>
                    <option value="c3">green</option>
                    <option value="c4">pink</option>
                    </select>
<input type ="submit">
</form>

on the next page after the form is submitted i am trying to capture the same values

<form name="form2">
<select name="color[]" multiple="multiple" id="color" size="4">
                    <option value="c1" [onshow;forms;block=begin;when
                                            [forms.color]='c1'
                                            ]selected [onshow;forms;block=end]>red</option>
                    <option value="c2" [onshow;forms;block=begin;when
                                            [forms.color]='c2'
                                            ]selected [onshow;forms;block=end]>yellow</option>
                    <option value="c3" [onshow;forms;block=begin;when
                                            [forms.color]='c3'
                                            ]selected [onshow;forms;block=end]>green</option>
                    <option value="c4" [onshow;forms;block=begin;when
                                            [forms.color]='c4'
                                            ]selected [onshow;forms;block=end]>pink</option>
                    </select>
<input type ="submit">
</form>


Unable to get the desired output using the above code. Please suggest.
By: Skrol29
Date: 2013-09-09
Time: 22:42

Re: Retrieve or hightlight the dropdown selected values

Hi Suneel,

I suggest that you have a loot at the HTML plugin for TBS (available with the TBS package).
This plugin helps to select items in a list.

The other way is to use parameter "att" with parameter "atttrue".
By: Suneel Kumar
Date: 2013-09-11
Time: 09:10

Re: Retrieve or hightlight the dropdown selected values

Thanks Skrol29.

Can you provide any example?
By: Skrol29
Date: 2013-09-12
Time: 02:23

Re: Retrieve or hightlight the dropdown selected values

By: Sheepy
Date: 2013-09-12
Time: 04:23

Re: Retrieve or hightlight the dropdown selected values

Example. Should be pretty simple and almost identical to the one given by Skrol29.

include( 'tbs_class.php' );
include( 'tbs_plugin_html.php' );
var_dump( $_POST );
$TBS = new clsTinyButStrong();
$TBS->Source = <<<EOL
   <form method="POST">
      <select name="color[]" multiple="multiple">
         <option value="[opt.$]">[opt.val; block=option]</option>
         <option>[onshow._POST.color; noerr; ope=html; select]</option>
      </select>
      <input type ="submit">
   </form>
EOL;
$TBS->MergeBlock( 'opt', [ 'c1'=>'Red', 'c2'=>'Green', 'c3'=>'Blue' ] );
$TBS->Show();