Jump to content
UBot Underground

Loading UI HTML Dropdown from a list?


Recommended Posts

So I have been trying to figure out how to load a ui html dropdown from a list. Basically the list cannot be created until login because it scrapes the data from the page and populates the list and then the list should populate the dropdown.

 

I can do this with the regular UI dropdown very easily, but I can't seem to figure this out with the UI HTML panel dropdown.

 

I have tried filling the fillwith="value" with fillwith="%listname" but that doesn't work

 

Does anyone have an idea how to do this?

Link to post
Share on other sites

if you using html all options on the drop down should have the option tag for example:

 

<select name="typecar" variable="#car" fillwith="value">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>

 

What the fillwith means is that the selector will be filled with the current value held by the variable

 

I hope that makes sense to you.

 

In short you cant load it from a list like that.

Link to post
Share on other sites

You need to add each list item into a new list as

 

<option>List Item</option>

 

Set that new list to a variable. Then have an optgroup in your select menu that's reading from that variable. I'm on my ipad right now but I'll try to post an example when I get to the office tommorow.

Link to post
Share on other sites

if you using html all options on the drop down should have the option tag for example:

 

<select name="typecar" variable="#car" fillwith="value">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>

 

What the fillwith means is that the selector will be filled with the current value held by the variable

 

I hope that makes sense to you.

 

In short you cant load it from a list like that.

 

No This doesn't make sense for what I am trying to do. That works fine for a dropdown that is pre-poulated with the options, but not if I am trying to poulate the dropdown from say a scraped list. Let me try to explain better.

 

1. Bot logs into website

2. Bot scrapes page

3. Bot adds scraped content to a list that looks something like this....

item1

item2

item3

item4

4. Here I want the bot to take the list data it just scraped and populate the options in the dropdown

5. Bot pauses and alerts user to select the dropdown and click run again.

6. Bot continues from there.

Link to post
Share on other sites

 

 

No This doesn't make sense for what I am trying to do. That works fine for a dropdown that is pre-poulated with the options, but not if I am trying to poulate the dropdown from say a scraped list. Let me try to explain better.

 

1. Bot logs into website

2. Bot scrapes page

3. Bot adds scraped content to a list that looks something like this....

item1

item2

item3

item4

4. Here I want the bot to take the list data it just scraped and populate the options in the dropdown

5. Bot pauses and alerts user to select the dropdown and click run again.

6. Bot continues from there.

 

It's explained 1 post above.

Link to post
Share on other sites

You need to add each list item into a new list as

 

<option>List Item</option>

 

Set that new list to a variable. Then have an optgroup in your select menu that's reading from that variable. I'm on my ipad right now but I'll try to post an example when I get to the office tommorow.

 

I'm very interested to see how this works. I can't seem to figure out where the variable goes in all of that.

Link to post
Share on other sites

Hey here ya go. Just make sure you put each item of the list wrapped with <option></option>

 

<select variable="#VariableOfSelection" fillwith="value"

style="width: 220px;">

<optgroup variable="#VariableThatContainsListFormatted" fillwith="innertext"></optgroup>

</select>

Link to post
Share on other sites

Hey here ya go. Just make sure you put each item of the list wrapped with <option></option>

 

<select variable="#VariableOfSelection" fillwith="value"

style="width: 220px;">

<optgroup variable="#VariableThatContainsListFormatted" fillwith="innertext"></optgroup>

</select>

 

This isn't working for me. Is there something I need to do to get it to load in the UI HTML Panel? As it stands the only thing I have changed in your snippet is the variables.

 

add list to list(%webaccounts, $scrape attribute(<outerhtml=w"<a class=\"gwt-Anchor GEM1BC3DMI\" href=\"https://www.google.com/webmasters/tools/dashboard?hl=en&siteUrl=http%3A%2F%2F*%2F\">*</a>">, "innertext"), "Delete", "Global")
loop($list total(%webaccounts)) {
   add item to list(%webaccounts_edited, "<option>{$next list item(%webaccounts)}</option>", "Delete", "Global")
}
set(#dropdown options, %webaccounts_edited, "Global")

Link to post
Share on other sites

Sorry, my bad! Change the 2nd fillwith box to "innerhtml"

 

<select variable="#VariableOfSelection" fillwith="value"
style="width: 220px;">
<optgroup variable="#VariableThatContainsListFormatted" fillwith="innerhtml"></optgroup>
</select>

Link to post
Share on other sites

Sorry, my bad! Change the 2nd fillwith box to "innerhtml"

 

<select variable="#VariableOfSelection" fillwith="value"
style="width: 220px;">
<optgroup variable="#VariableThatContainsListFormatted" fillwith="innerhtml"></optgroup>
</select>

 

Woo F'in Hoo!!!!

 

Hell Yeah. Thanks so much for that. It's so amazing the difference 4 lines of code can make on your moral! MUCH APPRECIATED!!!!!

Link to post
Share on other sites

Hey Venture,

 

I'm running into a couple of issues with this.

 

1. After I select the item from the dropdown it displays the first option again. It is showig correctly in the debugger, but not in the dropdown itself.

2. If I select an option from the dropdown it sets that option for that variable correctly, but only the first time I make the selection. If I try to select a different option the variable remains the same.

 

Any thoughts?

Link to post
Share on other sites

Hmmm... not sure. It works well for me. If you check out the video within the sales thread of my signature you'll see that I use this all the time. Are you trying to use it as a listbox instead of a dropdown because that doesn't work? There's lots of bugs in the UI HTML panel and thats one of them. What happens when you totally isolate the script and only have that one dropdown in the UI HTML Panel?

Link to post
Share on other sites

Hmmm... not sure. It works well for me. If you check out the video within the sales thread of my signature you'll see that I use this all the time. Are you trying to use it as a listbox instead of a dropdown because that doesn't work? There's lots of bugs in the UI HTML panel and thats one of them. What happens when you totally isolate the script and only have that one dropdown in the UI HTML Panel?

 

So I have isolated the dropdown within the html panel, but when I click the dropdown it still shows the first option. I made a screencast to show you what I mean. It could be just a buggy UI html panel.

 

http://screencast.com/t/L2LYmpMpa4

Link to post
Share on other sites

Nice job guys!

 

While using a List and Loop may be justified don't let that be a factor in deciding to create the same effect. You don't a List or a Loop to get the same effect.

 

So before jumping on my posts just study my code first.

 

 

navigate("http://ubotsandbox.com/ubot-simple-list.php", "Wait")
set(#mydropdown, $scrape attribute(<id="links2scrape">, "innertext"), "Global")
set(#mydropdown, "<option>{$replace(#mydropdown, "
", "</option>
<option>")}</option>", "Global")
ui html panel("<select variable=\"#VariableOfSelection\" fillwith=\"value\" style=\"width: 220px;\">
<optgroup variable=\"#mydropdown\" fillwith=\"innerhtml\"></optgroup>
</select>", 100)

 

Generally speaking if I can do something without a List and a Loop then I will go that path...but that's me.

 

This is just another method in how to skin a cat or beat a dead horse.

 

Buddy

  • Like 1
Link to post
Share on other sites

navigate("http://ubotsandbox.com/ubot-simple-list.php", "Wait")
set(#mydropdown, $scrape attribute(<id="links2scrape">, "innertext"), "Global")
set(#mydropdown, "<option>{$replace(#mydropdown, "
", "</option>
<option>")}</option>", "Global")
ui html panel("<select variable=\"#VariableOfSelection\" fillwith=\"value\" style=\"width: 220px;\">
<optgroup variable=\"#mydropdown\" fillwith=\"innerhtml\"></optgroup>
</select>", 100)

 

That's much cleaner than the way I did it. I will have to think of that more often. Trying not to use lists when possible.

Link to post
Share on other sites

So I created another bot with similar functionality and the damn this is whacky again! :( Dumb UI Panel. Sometimes this stuff is frustrating. Still thanks for all the help guys!

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

I'm having same issues.  Loading the <options> from a list how botbuddy described, setting text from list.  But I as soon as I select something from the drop down, it goes back to the first item in the list???  I've tried everything, including rebooting my PC.  Happens in Ubot and the compiled bot.  Debugger is showing the selected item remains the active variable, but as soon as I click another item in the UI panel, variable goes back to first item value.

 

Super frustrating.

Link to post
Share on other sites

Ran ubotbuddy's code snippet with same results, seems like bug to me.  Easily reproduced with this code from page 1.

 

http://www.screencast.com/t/o0mWgOtm

 

 

navigate("http://ubotsandbox.com/ubot-simple-list.php", "Wait")
set(#mydropdown, $scrape attribute(<id="links2scrape">, "innertext"), "Global")
set(#mydropdown, "<option>{$replace(#mydropdown, "
", "</option>
<option>")}</option>", "Global")
ui html panel("<select variable=\"#VariableOfSelection\" fillwith=\"value\" style=\"width: 220px;\">
<optgroup variable=\"#mydropdown\" fillwith=\"innerhtml\"></optgroup>
</select>", 100)
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...