Bryn 0 Posted March 22, 2014 Report Share Posted March 22, 2014 What is the best way to select multiple items in a multiple select dropdown? The change dropdown easily does 1 item, but not sure how to select more than 1? Quote Link to post Share on other sites
UBotDev 276 Posted March 22, 2014 Report Share Posted March 22, 2014 I think you should be able to use click command instead of change dropdown. Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted March 22, 2014 Report Share Posted March 22, 2014 This plugin http://www.ubotstudio.com/forum/index.php?/topic/16146-sell-plugin-advanced-dialog/ have that option to select multiple items from a dropdown menu. Quote Link to post Share on other sites
Bryn 0 Posted March 22, 2014 Author Report Share Posted March 22, 2014 I have tried the click but each time I click the next item the others are no longer selected. I need a Ctrl-click on 4 items in the drop down box. A multiple drop down option is pretty common for HTML forms, so it seems there should be some way to navigate it within ubot. Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted March 22, 2014 Report Share Posted March 22, 2014 I have tried the click but each time I click the next item the others are no longer selected. I need a Ctrl-click on 4 items in the drop down box. A multiple drop down option is pretty common for HTML forms, so it seems there should be some way to navigate it within ubot. We already tried everything before to select multiple items in a dropdown on html but ubot UI have some limitations. Using a plugin is your best option. Quote Link to post Share on other sites
UBotDev 276 Posted March 23, 2014 Report Share Posted March 23, 2014 I have tried the click but each time I click the next item the others are no longer selected. I need a Ctrl-click on 4 items in the drop down box. A multiple drop down option is pretty common for HTML forms, so it seems there should be some way to navigate it within ubot. You are right, that doesn't work with HTML select input. However, it's doable with javascript (I borrowed the code from here): load html("<select id=\"choice\" multiple=\"multiple\"> <option value=\"1\">One</option> <option value=\"2\">two</option> <option value=\"3\">three</option> </select>") wait for element(<id="choice">, "", "Appear") run javascript("var optionsToSelect = [\'One\', \'three\']; var select = document.getElementById( \'choice\' ); for ( var i = 0, l = select.options.length, o; i < l; i++ ) \{ o = select.options[i]; if ( optionsToSelect.indexOf( o.text ) != -1 ) \{ o.selected = true; \} \}") We already tried everything before to select multiple items in a dropdown on html but ubot UI have some limitations. Using a plugin is your best option. I guess you haven't tried it with JavaScript, since it works even in the UI; here is an example for you: ui html panel("<select id=\"choice\" multiple=\"multiple\"> <option value=\"1\">One</option> <option value=\"2\">two</option> <option value=\"3\">three</option> </select> <input type=\"hidden\" value=\"\" variable=\"#UI Trigger\" onchange=\"selectMultiple()\"> <script> function selectMultiple()\{ var optionsToSelect = [\'One\', \'three\']; var select = document.getElementById( \'choice\' ); for ( var i = 0, l = select.options.length, o; i < l; i++ ) \{ o = select.options[i]; if ( optionsToSelect.indexOf( o.text ) != -1 ) \{ o.selected = true; \} \} \} </script>", 100) set(#UI Trigger, 1, "Global") Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted March 23, 2014 Report Share Posted March 23, 2014 Hi UbotDev, Yes it select multiple items but it didnt send the value to the variable.. Quote Link to post Share on other sites
UBotDev 276 Posted March 23, 2014 Report Share Posted March 23, 2014 Hi UbotDev, Yes it select multiple items but it didnt send the value to the variable..It's doable....you would need to have 1 UBot variable for each value from dropdown and you would be setting them from JavaScript. Quote Link to post Share on other sites
JohnKP 0 Posted July 21, 2014 Report Share Posted July 21, 2014 This plugin http://www.ubotstudio.com/forum/index.php?/topic/16146-sell-plugin-advanced-dialog/ have that option to select multiple items from a dropdown menu.Can you help explain how this works? I have this plugin and understand how to create dropdowns, but not how you would use it on a website to select multiple options in a combo box. Thanks for any help 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.