Jump to content
UBot Underground

WHM Automation question: How can I select from 'Package' dropdown?


Recommended Posts

Hi guys,

 

Well, I'm actually quite the noob and I'm stuck on selecting an option in a dropdown. I'm trying to automate the task of creating accounts on my server through WHM but when i try to select one of my predefined packages it doesn't work correctly.

 

 

The form looks like:

<form onsubmit="checkacctform();" name="mainform" action="/scripts5/wwwacct">
<input type="hidden" value="" name="sign">
<input type="hidden" name="plan" value="testing_tiny">
<div id="domain_information" class="form_action">
<input id="dbuser" type="hidden" value="" name="dbuser">
<div id="package_div" class="form_action">
<fieldset>
<h3>Package</h3>
<ul>
<li>
<div class="fields">
<label class="fixed" for="pkgselect">Choose a Package</label>
<select id="pkgselect" class="" style="width:150px;" name="msel" onchange="updateform(document.mainform.msel.options[document.mainform.msel.selectedIndex].value)">
<option value="n,y,unlimited,y,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,y,0,0">---</option>
<option class="creatable" autocomplete="off" autofill="off" value="n,y,1024,n,x3,unlimited,unlimited,unlimited,unlimited,unlimited,2048,n,0,0,default,en,testing_community">testing_community</option>
<option class="creatable" autocomplete="off" autofill="off" value="n,y,500,n,x3,unlimited,unlimited,unlimited,unlimited,unlimited,2048,n,99,99,default,en,testing_default">testing_default</option>
<option class="creatable" autocomplete="off" autofill="off" value="n,y,200,n,x3,unlimited,unlimited,unlimited,unlimited,unlimited,1024,n,0,0,default,en,testing_tiny">testing_tiny</option>
<option class="creatable" autocomplete="off" autofill="off" value="n ,y,15000,y,x3,10,100,100,10,100,10000,n,100,100,default,english,Reseller Example">Reseller Example</option>
<option class="creatable" autocomplete="off" autofill="off" value="n,y,1,n,x3,1,1,1,1,1,1000,n,0,0,default,en,Reseller setup">Reseller setup</option>
</select>

 

and when I try to select from the dropdown, I'm presented with

 

n,y,unlimited,y,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,y,0,0
n,y,1024,n,x3,unlimited,unlimited,unlimited,unlimited,unlimited,2048,n,0,0,default,en,testing_community
n,y,500,n,x3,unlimited,unlimited,unlimited,unlimited,unlimited,2048,n,99,99,default,en,testing_default
(etc etc)

 

Is it possible to select from this dropdown if I only wanted to define the package name (ex. testing_community)?

 

I tried the "change chosen attribute" and "send key field chosen" commands and even though they change the field visually, the account is created with the "default" package setup instead of the defined one.

 

I selected and changed the value of the hidden field:

 

<input type="hidden" name="plan" value="testing_tiny">

 

and again it changed the field visually but the account was still created with the "default" package.

 

I'm assuming it has something to do with this updateform function...

 

 

function updateform(nfo) {
   var selectEl = document.mainform.msel;
   selectEl.className = selectEl.options[selectEl.selectedIndex].className;
   cpsets = nfo.split(",");
   // ip,cgi,quota,frontpage,cp,maxftp,maxsql,maxpop,maxlst,maxsub,plan,maxpark,maxaddon
   
   if (document.mainform.ip) {
       if (cpsets[0] == "n") {
           document.mainform.ip.checked = false;
       } else {
           document.mainform.ip.checked = true;
       }
       showDiv('ipselect','ipchkbox');
   }

   if (cpsets[1] == "n") {
       document.mainform.cgi.checked = false;
   } else {
       document.mainform.cgi.checked = true;
   }
   
   if (cpsets[3] == "n") {
       document.mainform.frontpage.checked = false;
   } else {
       document.mainform.frontpage.checked = true;
   }
   
   if (document.mainform.quota) {
       document.mainform.quota.value = cpsets[2];
   }
   if (document.mainform.maxftp) {
       document.mainform.maxftp.value = cpsets[5];
   }
   if (document.mainform.maxsql) {
       document.mainform.maxsql.value = cpsets[6];
   }
   if (document.mainform.maxpop) {
       document.mainform.maxpop.value = cpsets[7];
   }
   if (document.mainform.maxlst) {
       document.mainform.maxlst.value = cpsets[8];
   }
   if (document.mainform.maxsub) {
       document.mainform.maxsub.value = cpsets[9];
   }
   if (document.mainform.bwlimit) {
       document.mainform.bwlimit.value = cpsets[10];
   }
   if (document.mainform.hasshell) {
       if (cpsets[11] == "n") {
           document.mainform.hasshell.checked = false;
       } else {
           document.mainform.hasshell.checked = true;
       }
   }
   if (document.mainform.cpmod) { 
       for (var i = 0; i < document.mainform.cpmod.options.length; i++) {
           if (document.mainform.cpmod.options[i].value == cpsets[4]) {
               document.mainform.cpmod.selectedIndex=i;
           }
       }
   }
       document.mainform.plan.value = cpsets[cpsets.length-1];

   if (document.mainform.maxpark) {
       if (cpsets[12]) {
           document.mainform.maxpark.value = cpsets[12];
       } else {
           document.mainform.maxpark.value = 0;
       }
   }
   if (document.mainform.maxaddon) {
       if (cpsets[13]) {
           document.mainform.maxaddon.value = cpsets[13];
       } else {
           document.mainform.maxaddon.value = 0;
       }
   }
   if (document.mainform.featurelist) { 
       for (var i = 0; i < document.mainform.featurelist.options.length; i++) {
           if (document.mainform.featurelist.options[i].value == cpsets[14]) {
               document.mainform.featurelist.selectedIndex=i;
           }
       }
   }
   if (document.mainform.language) { 
       for (var i = 0; i < document.mainform.language.options.length; i++) {
           if (document.mainform.language.options[i].value == cpsets[15]) {
               document.mainform.language.selectedIndex=i;
           }
       }
   }
}

 

but I have no idea how to go about fixing this issue. Has anyone dealt with this situation or a similar one? At this point, I'm kinda lost.

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