ianshier 1 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) Hello guys.I was trying to set dynamic dropdown, first was from variable, and even from list and it doesn't work at all. This is a video how to do this. This is my ubot studio code. ui html panel("<!DOCTYPE html> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> <link id=\"CSS_Link\" href=\"\" rel=\"stylesheet\" > <link href=\"http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css\" rel=\"stylesheet\"> <link href=\"http://lazybots.com/bootstrap/icons/icon.css\" rel=\"stylesheet\"> <link href=\"http://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.2.1/css/bootstrap2/bootstrap-switch.min.css\" rel=\"stylesheet\"> <title></title> <style> </head> <body> <div id=\"Interface\" class=\"Interface\" style=\"height: 400px; width: 1000px; \"> <div class=\"container-fluid\"> <div class=\"row\"> <div id=\"Settings\" interheight=\"400\" interwidth=\"1000\" containerheight=\"350\" containerwidth=\"1000\" theme=\"\" navtype=\"Horizontal\"></div> <div id=\"Nav_Area\"><nav id=\"Nav\" class=\"navbar navbar-default\" role=\"navigation\"><div class=\"container-fluid\"><div class=\"navbar-header\"><a id=\"Nav_Brand\" class=\"navbar-brand\">Branding</a></div><ul id=\"Nav_Links\" class=\"nav navbar-nav ui-sortable\"> <li class=\"ui-state-default\"><a ph=\"\" class=\"Nav_Link\" id=\"Wrapper-1555266\" etype=\"NAVLINK\">test</a></li></ul></div></nav></div> <div id=\"Content_Area\"><div class=\"Containment-Wrapper\" id=\"Containment-Wrapper-1555266\" style=\"height: 350px; width: 1000px; display: block; \"><div etype=\"DYNAMIC_DROP\" style=\"width: 200px; top: 59px; left: 1px; position: absolute; \" class=\"input-group-sm draggable ui-draggable firstelement\" id=\"Element_6980864\"><div class=\"handle\"></div><label>Select a dropdown:</label><select variable=\"#Selected_Num\" class=\"form-control\" list=\"#Select_List\" list-fillwith=\"options\"></select></div></div></div> </div> </div> </div> </body> <script src=\"http://code.jquery.com/jquery-latest.min.js\" type=\"text/javascript\"></script> <script src=\"http://code.jquery.com/ui/1.10.4/jquery-ui.js\" type=\"text/javascript\"></script> <script src=\"http://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.2.1/js/bootstrap-switch.min.js\" type=\"text/javascript\"></script> <script> $(document).ready(function()\{ var DiaOpen = false; //INIT DIALOG $(\".dialog_element\").dialog(\{autoOpen: false, modal: true, closeOnEscape: false, hide: \{effect: \"explode\", duration: 800\}, show: \{effect: \"explode\", duration: 500\}\}); $(document).tooltip(\{ tooltipClass: \"tool\" \}); $(\".switch\").bootstrapSwitch(); $(\".dialog_link\").click(function()\{ if(DiaOpen == false)\{ DiaOpen = true; var DialogToShow = $(this).attr(\"id\"); var Height = parseInt($(\"#Show_\" + DialogToShow).attr(\"diah\")); var Width = parseInt($(\"#Show_\" + DialogToShow).attr(\"diaw\")); Height += 56; var effect = $(\"#Show_\" + DialogToShow).attr(\"effect\"); $(\"#Show_\" + DialogToShow).dialog(\{autoOpen: false, modal: true, closeOnEscape: false, hide: \{effect: effect, duration: 800\}, show: \{effect: effect, duration: 500\},width: Width,height:Height,position: \"center\"\}).dialog(\"open\"); \} \}); $(\".Close_Dialog\").click(function() \{ $(\".dialog_element\").dialog(\"close\"); DiaOpen = false; \}); $(document).on(\"click\", \".Nav_Link\", function() \{ var SelectedWrapper = $(this).attr(\"id\"); var PanelHeading = $(this).attr(\"ph\"); $(\".change-panel-heading\").text(PanelHeading); $(\".Containment-Wrapper\").hide(); $(\"#Containment-\" + SelectedWrapper).show(); \}); $(document).on(\"click\",\".trigger\",function()\{ var triggerButton = $(this); var hiddenids = triggerButton.attr(\"hiddenids\").split(\",\"); var onval = triggerButton.attr(\"onval\"); var offval = triggerButton.attr(\"offval\"); $.each(hiddenids,function(index,value)\{ var hiddenele = $(\"#\"+hiddenids[index]); if(hiddenele.is(\":visible\"))\{ triggerButton.val(onval); hiddenele.hide(); \}else\{ hiddenele.show(); triggerButton.val(offval); \} \}); \}); //Shows/Hides Dropdown $(\'li.dropdown\').hover(function() \{ $(\'.dropdown-menu\', this).fadeIn(\'fast\'); \}, function() \{ $(\'.dropdown-menu\', this).fadeOut(\'fast\'); \}); \}); </script> </html>", 400) set(#Select_List, "Option 1,Option 2, Option 3", "Global") define Change { } Debugger:http://scr.hu/36xk/iuue0 I wrote to Carl many times, without success.Thanks for reply BTW. I deleted styles(post was too long) Edited February 15, 2015 by ianshier Quote Link to post Share on other sites
LazyBotter 188 Posted February 19, 2015 Report Share Posted February 19, 2015 Try this code: ui html panel("<!DOCTYPE html> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> <link id=\"CSS_Link\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css\" rel=\"stylesheet\" > <link href=\"http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css\" rel=\"stylesheet\"> <link href=\"http://lazybots.com/bootstrap/icons/icon.css\" rel=\"stylesheet\"> <link href=\"http://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.2.1/css/bootstrap2/bootstrap-switch.min.css\" rel=\"stylesheet\"> <title></title> <style> body \{ -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* Introduced in IE 10. See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/ */ -ms-user-select: none; user-select: none; \} .ui-dialog\{outline:none; z-index:9000;\} .draggable \{ width: auto; height: auto; position: absolute;\} .tool \{ position: absolute; width: auto; height: auto; line-height: 20px; padding: 4px; font-size: 14px; text-align: center; color: #000; background: rgb(255, 255, 255); border: 1px solid #000; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.0980392) 2px 2px 3px 0px; \} .off\{display:none;\} textarea \{ resize: none; \} .ui-dialog-titlebar-close \{visibility: hidden;\} .noHead .ui-dialog-titlebar \{display:none;\} .brand \{ max-height: 40px; margin:3px; \} </style> <style id=\"ThemeCSS\"> </style> </head> <body> <div id=\"Interface\" class=\"Interface\" style=\"height: 500px; width: 1000px; \"> <div class=\"container-fluid\"> <div class=\"row\"> <div id=\"Settings\" interheight=\"500\" interwidth=\"1000\" containerheight=\"450\" containerwidth=\"1000\" theme=\"\" navtype=\"Horizontal\"></div> <div id=\"Nav_Area\"><nav id=\"Nav\" class=\"navbar navbar-default\" role=\"navigation\"><div class=\"container-fluid\"><div class=\"navbar-header\"><a id=\"Nav_Brand\" class=\"navbar-brand\">Branding</a></div><ul id=\"Nav_Links\" class=\"nav navbar-nav ui-sortable\"> <li class=\"ui-state-default selected\"><a ph=\"\" class=\"Nav_Link\" id=\"Wrapper-8479069\" etype=\"NAVLINK\">Page 1</a></li></ul></div></nav></div> <div id=\"Content_Area\"><div class=\"Containment-Wrapper selected\" id=\"Containment-Wrapper-8479069\" style=\"height: 450px; width: 1000px; display: block; \"><div etype=\"DYNAMIC_DROP\" style=\"width: 200px; left: 363px; top: 129px; \" class=\"draggable ui-draggable\" id=\"Element_9073285\"><div class=\"handle\"></div><label>Loaded From Ubot:</label><select variable=\"#Selection_Variable\" class=\"form-control\" list=\"#List_Variable\" list-fillwith=\"options\" onchange=\"ubot.runScript(\'Alert This()\')\"></select></div></div></div> </div> </div> </div> </body> <script src=\"http://code.jquery.com/jquery-latest.min.js\" type=\"text/javascript\"></script> <script src=\"http://code.jquery.com/ui/1.10.4/jquery-ui.js\" type=\"text/javascript\"></script> <script src=\"http://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.2.1/js/bootstrap-switch.min.js\" type=\"text/javascript\"></script> <script> $(document).ready(function()\{ var DiaOpen = false; //INIT DIALOG $(\".dialog_element\").dialog(\{autoOpen: false, modal: true, closeOnEscape: false, hide: \{effect: \"explode\", duration: 800\}, show: \{effect: \"explode\", duration: 500\}\}); $(document).tooltip(\{ tooltipClass: \"tool\" \}); $(\".switch\").bootstrapSwitch(); $(\".dialog_link\").click(function()\{ if(DiaOpen == false)\{ DiaOpen = true; var DialogToShow = $(this).attr(\"id\"); var Height = parseInt($(\"#Show_\" + DialogToShow).attr(\"diah\")); var Width = parseInt($(\"#Show_\" + DialogToShow).attr(\"diaw\")); Height += 56; var effect = $(\"#Show_\" + DialogToShow).attr(\"effect\"); $(\"#Show_\" + DialogToShow).dialog(\{autoOpen: false, modal: true, closeOnEscape: false, hide: \{effect: effect, duration: 800\}, show: \{effect: effect, duration: 500\},width: Width,height:Height,position: \"center\"\}).dialog(\"open\"); \} \}); $(\".Close_Dialog\").click(function() \{ $(\".dialog_element\").dialog(\"close\"); DiaOpen = false; \}); $(document).on(\"click\", \".Nav_Link\", function() \{ var SelectedWrapper = $(this).attr(\"id\"); var PanelHeading = $(this).attr(\"ph\"); $(\".change-panel-heading\").text(PanelHeading); $(\".Containment-Wrapper\").hide(); $(\"#Containment-\" + SelectedWrapper).show(); \}); $(document).on(\"click\",\".trigger\",function()\{ var triggerButton = $(this); var hiddenids = triggerButton.attr(\"hiddenids\").split(\",\"); var onval = triggerButton.attr(\"onval\"); var offval = triggerButton.attr(\"offval\"); $.each(hiddenids,function(index,value)\{ var hiddenele = $(\"#\"+hiddenids[index]); if(hiddenele.is(\":visible\"))\{ triggerButton.val(onval); hiddenele.hide(); \}else\{ hiddenele.show(); triggerButton.val(offval); \} \}); \}); //Shows/Hides Dropdown $(\'li.dropdown\').hover(function() \{ $(\'.dropdown-menu\', this).fadeIn(\'fast\'); \}, function() \{ $(\'.dropdown-menu\', this).fadeOut(\'fast\'); \}); \}); </script> </html>", 500) set(#List_Variable, "Item1,Item2,Item3,Item4", "Global") define Alert This { alert(#Selection_Variable) } Here is another video for you too.. Carl :-) Quote Link to post Share on other sites
ianshier 1 Posted February 21, 2015 Author Report Share Posted February 21, 2015 Doesn't work.Nothing changed when I clicked run.(only variables in debugger, but list didn't show) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.