Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by uvaraj on Aug 29, 2008 04:43
open dhtmlx forum
How can i maintain selected value on tool bar combobox?

Dear Support Team!


I am using Dhtmlx tool bar, here i am using combo box if i select any item that event is refreshing to get the data form Database.
But i need to show selected item on the combo box which is in toolbar, even the page gor refreshed.

If i select page source i can't see either name or id for that select box


code i am using in the xml
<SelectButton name="Reseller" id="0_select" width="50px" height="16px">
<option value="net">net</option>
        <option value="tel">tel</option>
</SelectButton>    

i am trying to send the data to toolbar select box like

<script>
    alert(document.getElementById('0_select').value);
    document.getElementById('0_select')['<?=$_REQUEST[showreseller]?>'].value='<?=$_REQUEST[showreseller]?>';
</script>

When running the page on the browser select box dont have id or name, so i can't assign the data.

Please help me how can i maintain the selected option on the select box of toolbar?

or

how can i assign through javascript?


Please help me in solving this

thanks
Uva
Answer posted by Support on Aug 29, 2008 05:57
You can use code similar to next

var toolbar = new dhtmlXToolbarObject(...
toolbar.loadXML(url,function(){
         toolbar.getItem("0_select").setSelected("<?=$_REQUEST[showreseller]?>")
});

Answer posted by uvaraj on Aug 29, 2008 06:07
Hi Thanks for your reply


I have use the code you sent but it is noe showing the selected item after page get refreshed.

i used code like below

aToolBar=new dhtmlXToolbarObject(document.getElementById('toolbar_zone'),'100%',16," ");
        aToolBar.setOnClickHandler(onButtonClick);
          aToolBar.loadXML("/_toolbar.xml",function(){
                     toolbar.getItem("0_select").setSelected("<?=$_REQUEST[showreseller]?>")
    });
        aToolBar.showBar();

thanks
uva
Answer posted by Support on Aug 29, 2008 10:11

Which value takes <?=$_REQUEST[showreseller]?> in your case?
To work correctly it must have the same value as option values in XML => "net" or "tel"

Please check attached sample. 

Attachments (1)