Categories > TinyButStrong general >

selected dropdown with javascript

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: syscoid
Date: 2008-01-11
Time: 22:58

selected dropdown with javascript

my sample code :
<form name="inquiry">
<input type="hidden" name="bl">
<tr>
<td><SELECT name="bl" style="width:140px;" id="bl" class="input">
                                                <option value=""></option>
                                                <option value="[BLblk.trn]">[BLblk.trn;block=option]</option>
                                            </SELECT>
                                              <script>
                                                var z=ComboFromSelect("bl");
                                                z.enableFilteringMode(true);
                                                z.selectOption();
                                               
                                                function getvalue(n){
                                                     document.inquiry.bl.value = n;
                                                  }
                                        </script></td>

<td><input type="submit" name="Action" value="Search" class="button" onClick="getvalue(z.getSelectedValue())"></td>
</tr>
</form>
------------------------------------------------------------

Why can`t selected value in combo?
give me solution.. Thanks 
By: syscoid
Date: 2008-01-11
Time: 23:07

Re: selected dropdown with javascript

we give after :
<form name="inquiry">
<input type="hidden" name="bl">
<tr>
<td><SELECT name="bl" style="width:140px;" id="bl" class="input">
                                                <option value=""></option>
                                                <option value="[BLblk.trn]">[BLblk.trn;block=option]</option>
                                            </SELECT>
             <script>
                                                var z=ComboFromSelect("bl");
            z.enableFilteringMode(true);
            z.selectOption();
          
            function getvalue(n){
                 document.inquiry.bl.value = n;
              }
                                        </script></td>

<td><input type="submit" name="Action" value="Search" class="button" onClick="getvalue(z.getSelectedValue())"></td>
</tr>
</form>

add:
<form name="inquiry">
<input type="hidden" name="bl">
<tr>
<td><SELECT name="bl" style="width:140px;" id="bl" class="input">
                                                <option value=""></option>
                                                <option value="[BLblk.trn]">[BLblk.trn;block=option]</option>
<option value="[var.trn_id;ope=html;select]">[trn]</option>
                                            </SELECT>
             <script>
                                                var z=ComboFromSelect("bl");
            z.enableFilteringMode(true);
            z.selectOption();
          
            function getvalue(n){
                 document.inquiry.bl.value = n;
              }
                                        </script></td>

<td><input type="submit" name="Action" value="Search" class="button" onClick="getvalue(z.getSelectedValue())"></td>
</tr>
</form>
----------------------------------------------------------------------

can`t run this selected box
By: Skrol29
Date: 2008-01-13
Time: 15:00

Re: selected dropdown with javascript

Hi Syscoid,

Your description is too shot to be able to help you.
Can you detail what result is expected, and what do you actually have ?

Do you have any Javascript errors ?
Do you have any TBS errors ?

Also, you should check you Javascript code.
The line "document.inquiry.bl.value = n;" may be not correct to select an item in a listobox. I know a Listbox has the property "selectedIndex" but I'm not sure the property "value" is available.