Josh 37 Posted October 6, 2012 Report Share Posted October 6, 2012 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? Quote Link to post Share on other sites
P0s3id0n 90 Posted October 6, 2012 Report Share Posted October 6, 2012 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. Quote Link to post Share on other sites
VentureOnline 49 Posted October 6, 2012 Report Share Posted October 6, 2012 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. Quote Link to post Share on other sites
Josh 37 Posted October 6, 2012 Author Report Share Posted October 6, 2012 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 website2. Bot scrapes page3. Bot adds scraped content to a list that looks something like this.... item1 item2 item3 item44. Here I want the bot to take the list data it just scraped and populate the options in the dropdown5. Bot pauses and alerts user to select the dropdown and click run again.6. Bot continues from there. Quote Link to post Share on other sites
VentureOnline 49 Posted October 6, 2012 Report Share Posted October 6, 2012 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 website2. Bot scrapes page3. Bot adds scraped content to a list that looks something like this.... item1 item2 item3 item44. Here I want the bot to take the list data it just scraped and populate the options in the dropdown5. Bot pauses and alerts user to select the dropdown and click run again.6. Bot continues from there. It's explained 1 post above. Quote Link to post Share on other sites
Josh 37 Posted October 6, 2012 Author Report Share Posted October 6, 2012 It's explained 1 post above. Yeah I just happened to be typing that as you posted. I am looking into the optgroup Quote Link to post Share on other sites
Josh 37 Posted October 6, 2012 Author Report Share Posted October 6, 2012 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. Quote Link to post Share on other sites
VentureOnline 49 Posted October 6, 2012 Report Share Posted October 6, 2012 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> Quote Link to post Share on other sites
Josh 37 Posted October 6, 2012 Author Report Share Posted October 6, 2012 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") Quote Link to post Share on other sites
VentureOnline 49 Posted October 6, 2012 Report Share Posted October 6, 2012 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> Quote Link to post Share on other sites
Josh 37 Posted October 6, 2012 Author Report Share Posted October 6, 2012 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!!!!! Quote Link to post Share on other sites
VentureOnline 49 Posted October 6, 2012 Report Share Posted October 6, 2012 You got it! Quote Link to post Share on other sites
Josh 37 Posted October 7, 2012 Author Report Share Posted October 7, 2012 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? Quote Link to post Share on other sites
VentureOnline 49 Posted October 7, 2012 Report Share Posted October 7, 2012 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? Quote Link to post Share on other sites
Josh 37 Posted October 7, 2012 Author Report Share Posted October 7, 2012 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 Quote Link to post Share on other sites
Josh 37 Posted October 8, 2012 Author Report Share Posted October 8, 2012 It's wierd, I didn't change anything and all of the sudden it started working correctly. Quote Link to post Share on other sites
VentureOnline 49 Posted October 8, 2012 Report Share Posted October 8, 2012 Yep that sounds like the UI HTML Panel Quote Link to post Share on other sites
UBotBuddy 331 Posted October 8, 2012 Report Share Posted October 8, 2012 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 1 Quote Link to post Share on other sites
VentureOnline 49 Posted October 8, 2012 Report Share Posted October 8, 2012 Great trick Buddy! Quote Link to post Share on other sites
Josh 37 Posted October 8, 2012 Author Report Share Posted October 8, 2012 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. Quote Link to post Share on other sites
Josh 37 Posted October 8, 2012 Author Report Share Posted October 8, 2012 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! Quote Link to post Share on other sites
mojpoj 0 Posted February 4, 2013 Report Share Posted February 4, 2013 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. Quote Link to post Share on other sites
mojpoj 0 Posted February 4, 2013 Report Share Posted February 4, 2013 Screen cast: http://www.screencast.com/t/1c0Cflbe3L Quote Link to post Share on other sites
mojpoj 0 Posted February 4, 2013 Report Share Posted February 4, 2013 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) Quote Link to post Share on other sites
blueBottle 1 Posted February 10, 2013 Report Share Posted February 10, 2013 Got this issue as well.. ugh.. 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.