Jump to content
UBot Underground

Recommended Posts

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?

 

 

 

 

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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")
Link to post
Share on other sites

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.

Link to post
Share on other sites
  • 3 months later...

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...