Jump to content
UBot Underground

Anyone have a good idea on how to handle this?


Recommended Posts

I am trying to make 3 dynamic drop downs  for this : https://www.marktplaats.nl/syi/plaatsAdvertentie.html

I want the drop downs to to simulate the menus on the site and act exactly the same.

 

So when i choose something on the first drop down in my ui i want the second to change.

Has anyone done anything like this?

 

Link to post
Share on other sites

just an idea, since you have dev license and "onload command" you can put loop while command inside which will loop until all 3 columns data is selected and pulling next list inside ui list command after selecting 1st  column value, 2nd column value and exiting when user has selected all 3 column values

Link to post
Share on other sites

I am trying to make 3 dynamic drop downs  for this : https://www.marktplaats.nl/syi/plaatsAdvertentie.html

I want the drop downs to to simulate the menus on the site and act exactly the same.

 

So when i choose something on the first drop down in my ui i want the second to change.

Has anyone done anything like this?

 

I am adding a feature to my UI Builder to do exactly this. It will add a lot of code to your bot, but the builder will create the code for you.

I know you already have the UI Builder, are you in a hurry to get this done?

 

Darryl.

Link to post
Share on other sites

Wow you are too good to be true Darryl!!!!

This is something that has bugged me for months i just could not find a way to do it without breaking the flow of my bots.

I tested a lot of different ways to do it but some involved starting the bot 3 times so it could scrape the lists and add them to my ui dropdowns.

 

You do not need to rush anything because of me but it would be nice to get this bot ready so i can leave it as it is.

Link to post
Share on other sites

Here is a simple example with 2 dropdowns and 2 variables (just copy paste it to UBot and it should work):

ui html panel("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html>
<head>
	<title>Dynamic Listbox</title>

</head>
<body>
	<div class=\"form-group\" id=\"first_name-container\">
		<label for=\"category\">Category</label>
		<select class=\"form-control\" id=\"category\" variable=\"#Data Category\" fillwith=\"value\" size=\"4\" >
			<option value=\"\">Select One</option>
			<option value=\"1\" data-show=\"sub_cat_1\">1</option>
			<option value=\"2\" data-show=\"sub_cat_2\">2</option>
			<option value=\"3\" data-show=\"sub_cat_3\">3</option>
		</select>
	</div>
	
	<div class=\"form-group\" id=\"last_name-container\">
		<label>Sub-Category
		<select class=\"form-control\" id=\"sub_cat_1\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
			<option value=\"\">Select One</option>
			<option value=\"1\">1</option>
			<option value=\"2\">2</option>
			<option value=\"3\">3</option>
		</select>
		<select class=\"form-control\" id=\"sub_cat_2\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
			<option value=\"\">Select One</option>
			<option value=\"4\">4</option>
			<option value=\"5\">5</option>
			<option value=\"6\">6</option>
		</select>
		<select class=\"form-control\" id=\"sub_cat_3\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
			<option value=\"\">Select One</option>
			<option value=\"7\">7</option>
			<option value=\"8\">8</option>
			<option value=\"9\">9</option>
		</select>
		</label>
	</div>


    <!--SCRIPTS-->
    <script src=\"https://code.jquery.com/jquery-1.10.2.min.js\"></script>


	<script>
		$(\'#category\').bind(\'click\', function()\{
			$(\'#sub_cat_1\').hide();
			$(\'#sub_cat_2\').hide();
			$(\'#sub_cat_3\').hide();
			$(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).show();
			ubot.settingChanged(\'#Data SubCategory\', \'\');
			$(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).val(\'\');
			
		\});
	</script>
</body>
</html>
", 200)

Link to post
Share on other sites

Hi,

 

With 3rd one sample:

ui html panel("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html>
<head>
    <title>Dynamic Lisbox</title>
</head>
<body>
    <div class=\"form-group\" id=\"first_name-container\">
        <label for=\"category\">Category</label>
        <select class=\"form-control\" id=\"category\" variable=\"#Data Category\" fillwith=\"value\" size=\"4\" >
            <option value=\"\">Select One</option>
            <option value=\"1\" data-show=\"sub_cat_1\">1</option>
            <option value=\"2\" data-show=\"sub_cat_2\">2</option>
            <option value=\"3\" data-show=\"sub_cat_3\">3</option>
        </select>
    </div>
 
    <div class=\"form-group\" id=\"middle_name-container\">
        <label for=\"subcategory\">Sub-Category
        <select class=\"form-control\" id=\"sub_cat_1\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"1\" data-show=\"sub_sub_cat_1\">1</option>
            <option value=\"2\" data-show=\"sub_sub_cat_2\">2</option>
            <option value=\"3\" data-show=\"sub_sub_cat_3\">3</option>
        </select>        
        <select class=\"form-control\" id=\"sub_cat_2\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"4\" data-show=\"sub_sub_cat_4\">4</option>
            <option value=\"5\" data-show=\"sub_sub_cat_5\">5</option>
            <option value=\"6\" data-show=\"sub_sub_cat_6\">6</option>
        </select>
        <select class=\"form-control\" id=\"sub_cat_3\" variable=\"#Data SubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"7\" data-show=\"sub_sub_cat_7\">7</option>
            <option value=\"8\" data-show=\"sub_sub_cat_8\">8</option>
            <option value=\"9\" data-show=\"sub_sub_cat_9\">9</option>
        </select>
        </label>
    </div>
    <div class=\"form-group\" id=\"last_name-container\">
        <label>Sub-Sub-Category
        <select class=\"form-control\" id=\"sub_sub_cat_1\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"1\">1</option>
            <option value=\"2\">2</option>
            <option value=\"3\">3</option>
        </select>        
        <select class=\"form-control\" id=\"sub_sub_cat_2\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"4\">4</option>
            <option value=\"5\">5</option>
            <option value=\"6\">6</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_3\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"7\">7</option>
            <option value=\"8\">8</option>
            <option value=\"9\">9</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_4\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"10\">10</option>
            <option value=\"11\">11</option>
            <option value=\"12\">12</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_5\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"13\">13</option>
            <option value=\"14\">14</option>
            <option value=\"15\">15</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_6\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"16\">16</option>
            <option value=\"17\">17</option>
            <option value=\"18\">18</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_7\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"19\">19</option>
            <option value=\"20\">20</option>
            <option value=\"21\">21</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_8\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"22\">22</option>
            <option value=\"23\">23</option>
            <option value=\"24\">24</option>
        </select>
        <select class=\"form-control\" id=\"sub_sub_cat_9\" variable=\"#Data SubSubCategory\" fillwith=\"value\" size=\"4\" style=\"display:none\">
            <option value=\"\">Select One</option>
            <option value=\"25\">25</option>
            <option value=\"26\">26</option>
            <option value=\"27\">27</option>
        </select>
        </label>
    </div>

    <!--SCRIPTS-->
    <script src=\"https://code.jquery.com/jquery-1.10.2.min.js\"></script>

    <script>
        $(\'#category\').bind(\'click\', function()\{
            //alert($(this).find(\':selected\').attr(\'data-show\'));
            $(\'#sub_cat_1\').hide();
            $(\'#sub_cat_2\').hide();
            $(\'#sub_cat_3\').hide();
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).show();
            ubot.settingChanged(\'#Data SubCategory\', \'\');
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).val(\'\');
            
        \});

        $(\'#sub_cat_1\').bind(\'click\', function()\{
            //alert($(this).find(\':selected\').attr(\'data-show\'));
            $(\'#sub_sub_cat_1\').hide();
            $(\'#sub_sub_cat_2\').hide();
            $(\'#sub_sub_cat_3\').hide();
            $(\'#sub_sub_cat_4\').hide();
            $(\'#sub_sub_cat_5\').hide();
            $(\'#sub_sub_cat_6\').hide();
            $(\'#sub_sub_cat_7\').hide();
            $(\'#sub_sub_cat_8\').hide();
            $(\'#sub_sub_cat_9\').hide();
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).show();
            ubot.settingChanged(\'#Data SubSubCategory\', \'\');
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).val(\'\');
            
        \});

        $(\'#sub_cat_2\').bind(\'click\', function()\{
            //alert($(this).find(\':selected\').attr(\'data-show\'));
            $(\'#sub_sub_cat_1\').hide();
            $(\'#sub_sub_cat_2\').hide();
            $(\'#sub_sub_cat_3\').hide();
            $(\'#sub_sub_cat_4\').hide();
            $(\'#sub_sub_cat_5\').hide();
            $(\'#sub_sub_cat_6\').hide();
            $(\'#sub_sub_cat_7\').hide();
            $(\'#sub_sub_cat_8\').hide();
            $(\'#sub_sub_cat_9\').hide();
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).show();
            ubot.settingChanged(\'#Data SubSubCategory\', \'\');
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).val(\'\');
           
        \});

        $(\'#sub_cat_3\').bind(\'click\', function()\{
            //alert($(this).find(\':selected\').attr(\'data-show\'));
            $(\'#sub_sub_cat_1\').hide();
            $(\'#sub_sub_cat_2\').hide();
            $(\'#sub_sub_cat_3\').hide();
            $(\'#sub_sub_cat_4\').hide();
            $(\'#sub_sub_cat_5\').hide();
            $(\'#sub_sub_cat_6\').hide();
            $(\'#sub_sub_cat_7\').hide();
            $(\'#sub_sub_cat_8\').hide();
            $(\'#sub_sub_cat_9\').hide();
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).show();
            ubot.settingChanged(\'#Data SubSubCategory\', \'\');
            $(\'#\' + $(this).find(\':selected\').attr(\'data-show\')).val(\'\');
            
        \});
    </script>
</body>
</html>
", 300)

Kevin

Link to post
Share on other sites

If I remember correctly my old UBot v3 standard complained when you saved the bot and reopened it again, with DEV command inside the code, so I guess v4/v5 would do similar. Am not sure what would happen if you compile that.

Link to post
Share on other sites

Thanks for all the help guys,i got my dynamic drop-downs ready.

However there is a bug in ubot 4 stopping me from finishing my bot.Has anyone else problems with bots created in ubot 4 suddenly acting different then they used to do a while back?

Some of my pre created bots stopped working due to ubot 4 not working as it used to work.

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...