Jump to content

Change Drop Down List After Click Of Button


shobhitjain
 Share

Recommended Posts

What server-side scripting environment are you using? PHP? ASP?Is the data already in XML format? Does your browser need it in XML format, or does it just need the data?If you are using PHP, the easiest solution would be to read the data using simpleXML commands, and then sending it back to your browser as a JSON string.

Link to comment
Share on other sites

Apology for not describing the questions properly.i am using perl ,i have to request a URL to the server for xml and that server will return me xml data, i have used dynamic xml and put it on server and call that xml in my toolbar.but everytime i need new data i have to change that xml on server. i want to automate that process after click of button that dynamic xml gets updated from database automatically and populated to my toolbar

Link to comment
Share on other sites

Sorry, I'm still not understanding this completely. Here is what I think you're saying:The information begins in a database, and you convert it to XML before transmitting it to the browser. This conversion to XML happens because you want to send the data to your browser, and that is the only reason you are using XML. Is that right?Are you requesting and receiving this data using AJAX?If I understand the situation, it might be easier for your Perl script to create a JSON string. Here is an explanation, but maybe it is more complicated looking than it really needs to be: http://json.org/Here is the kind of string you want to produce in Perl. Obviously it can get more complicated:$str = 'myobject={name:"John",city:"Baltimore",age:27}';print $str;find it in javascript like this (assumes you have already sent an AJAX request): // declare the object variablevar myobject; var s = myAjaxRequest.responseText;// s is now a string, and myobject is still undefinedeval(s);// myobject now identifies a true JavaScript objectmyobject['name'] // returns 27

Edited by Deirdre's Dad
Link to comment
Share on other sites

ok let me tell you the whole thing,I am making a toolbar using toolbar studio,Now i need some data to be populated into my drop down list from server , when i click button the data in the drop down must be changed ,but i don't want to interact database directly,i just need to send a url with my id and token,so i make the use of xml.The button sends the xml request. But now i am totally confused. Can you please tell me what should i ideally do,

Link to comment
Share on other sites

I'm still as confused as before. It shouldn't matter that you're toolbar studio, since the result should still be HTML and javascript that you can read and understand. If you cannot understand what toolbar studio is producing, then you have a problem.I'm getting the impression that you don't really understand my questions or my suggestions.What you want is not difficult for someone who has more than basic knowledge of Perl and JavaScript. But I wonder if you are trying something that it way beyond your skill level. Maybe I'm wrong. I really can't tell.Post the code you are working with: the Perl, the HTML, the Javascript. It may be a help. But if your toolbar studio generates a lot of special code, sorting through it may take more time than I have to spend. My past experiences with programs that write code for you have not been good ones.

Link to comment
Share on other sites

No you are not wrong ,i know that being a fresher it is beyond my skill level but i have to do it.i can very well understand your suggestions and i am very thankful for that,<?xml version="1.0" encoding="utf-8"?><TOOLBAR icons="icons.bmp" hot_icons="icons.bmp" name="Untitled Toolbar" dllname="untitled" defenc="1251"><BUTTON id="tbs_button_003539" caption="No caption" type="Split" visibility="1" image="your_logo.bmp"/><BUTTON id="tbs_button_0AEWRF" caption="Uninstall" hint="Uninstall Toolbar" img="10" command="uninstall"/><SEPARATOR id="tbs_separator_008962"/><TEXT id="tbs_button_0FSDBS" caption="Text" hint="Text" img=""/><BUTTON id="tbs_button_013641" caption="No caption" type="Split" href="http://" visibility="1"><MENU id="tbs_menu_019920" type="Split"><ITEM id="tbs_item_003393" caption="Question1" visibility="1" enabled="1" command="redirect" href="http://www.google.com"/><ITEM id="tbs_item_003852" caption="Question2" visibility="1" enabled="1" command="redirect" href="http://www.msn.com"/><ITEM id="tbs_item_008976" caption="Question3" visibility="1" enabled="1" command="redirect" href="http://www.yahoo.com"/></MENU><MENU id="tbs_menu_1019920" type="Split"><ITEM id="tbs_item_1003393" caption="Question4" visibility="1" enabled="1" command="redirect" href="http://www.google.com"/><ITEM id="tbs_item_1003852" caption="Question5" visibility="1" enabled="1" command="redirect" href="http://www.msn.com"/><ITEM id="tbs_item_1008976" caption="Question6" visibility="1" enabled="1" command="redirect" href="http://www.yahoo.com"/></MENU></BUTTON></TOOLBAR> this is my xml which i put on server and gave the reference of this xml to my toolbar,when my toolbar gets loaded it shows these three items. now when i click button i need other 3 items ,you can say logical grouping or choosing based on ID or index.

Link to comment
Share on other sites

Well, if the XML already exists, you might as well use it. If you want to update your toolbar without refreshing your page, you will need AJAX. There is a tutorial here http://www.w3schools.com/ajax/default.asp, and tutorials all over the Net.You will also need to look at the tutorials that work with XML objects, since it's a little different.Then you'll need to study DOM methods for getting the data out of your XML object. You can start with that here: http://www.w3schools.com/dom/default.asp The syntax is NOT obvious and takes a little while to get used to.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...