DropDown list TO checkbox

Discussion in 'Software' started by SynBorg, Jul 31, 2013.

  1. SynBorg

    SynBorg Private E-2

    Hello

    my name is john

    respectfuly, i need you help.
    I hope u can help me,
    since i do not recieve any word from programmer in last 3 months.


    Issue is:
    - Need to convert dropdrown list to checkbox
    -its for web domain ordering.

    If someone is interrested in this,
    i will post code, or send u file.


    Thanks,
    john
     
  2. PC-XT

    PC-XT Master Sergeant

    It doesn't sound too complicated, but I wouldn't know until I saw the code.
     
  3. SynBorg

    SynBorg Private E-2

    Hello PC-XT

    Thank you for responding.
    U are first who responded in manny forums where i posted issue.

    Im very very very appreciate for your help.

    Im not much of coder programmer.
    So thanks in advance. Thanks thanks thanks so much


    code of domain checker embed file is below:


    <!DOCTYPE html>
    <html>
    <head>
    <title>Check domain</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <style type="text/css">
    body { margin: 0; }
    form {
    border: 1px solid #D1D1D1;
    }
    fieldset {
    border: 0px;
    }
    legend {
    padding-top: 15px;
    }
    p {
    margin: 0px;
    }
    textarea, select, input {
    border: 1px solid #D1D1D1;
    padding: 5px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    border-radius: 2px;
    background-color: white;
    }
    </style>
    </head>

    <body>
    <form method="post" action="" class="domainsearch" id="domain-checker">
    <fieldset>
    <p>
    <input type="text" id="dsearch" value="" name="sld" />
    <select id="dsearch" name="tld">
    <option value=".com" label=".com">.com</option>
    <option value=".asia" label=".asia">.asia</option>
    <option value=".biz" label=".biz">.biz</option>
    <option value=".bz" label=".bz">.bz</option>
    <option value=".ca" label=".ca">.ca</option>
    <option value=".cc" label=".cc">.cc</option>
    <option value=".de" label=".de">.de</option>
    <option value=".es" label=".es">.es</option>
    <option value=".eu" label=".eu">.eu</option>
    <option value=".in" label=".in">.in</option>
    <option value=".info" label=".info">.info</option>
    <option value=".me" label=".me">.me</option>
    <option value=".mobi" label=".mobi">.mobi</option>
    <option value=".name" label=".name">.name</option>
    <option value=".net" label=".net">.net</option>
    <option value=".org" label=".org">.org</option>
    <option value=".ru" label=".ru">.ru</option>
    <option value=".tel" label=".tel">.tel</option>
    <option value=".tv" label=".tv">.tv</option>
    <option value=".us" label=".us">.us</option>
    <option value=".ws" label=".ws">.ws</option>
    <option value=".xxx" label=".xxx">.xxx</option>
    </select>
    <button class="button large dsearch" type="submit"><span>Search</span></button>
    </p>
    </fieldset>
    </form>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(function() {
    $('#domain-checker').bind('submit',function(event){
    $.post('{{ constant('BB_URL_API') }}guest/servicedomain/check',
    $(this).serialize(),
    function(json) {
    if(json.error) {
    alert(json.error.message);
    } else if(json.result) {
    alert('Domain is available');
    } else {
    alert('Domain is already registered');
    }
    }, 'json');
    return false;
    });
    });
    </script>
    </body>
    </html>
     
  4. SynBorg

    SynBorg Private E-2

    i tried to send you PM but i do not yet have 50 posts.
    then, i posted here but its waiting for moderator approval.


    Thanks again
     
  5. PC-XT

    PC-XT Master Sergeant

    So, you are looking to make the select box into a number of checkboxes, one for each domain, so people can search multiple domains at the same time?

    I have some questions about this, so before you replace the original, try code I give you by uploading to the same place, but with a different name, then perform some searches with each domain, and multiple domains, to make sure it's working right, first. For instance, one test could be to try searching for a name that's not available in .com, but is in .asia, with both .com and .asia domains selected, then search for a name available in .com but not .asia.

    The API used to perform the search isn't listed in the html, (though {{ constant('BB_URL_API') }} refers to it) so I have no way to check that it actually supports multiple domain searches. You could test the following, which lets you select multiple items from the select box, for instance, by holding Ctrl while clicking them:
    PHP:
    <!DOCTYPE html>
    <
    html>
    <
    head>
    <
    title>Check domain</title>
    <
    meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <
    style type="text/css">
    body margin0; }
    form {
    border1px solid #D1D1D1;
    }
    fieldset {
    border0px;
    }
    legend {
    padding-top15px;
    }
    {
    margin0px;
    }
    textareaselectinput {
    border1px solid #D1D1D1;
    padding5px;
    -
    webkit-border-radius2px;
    -
    moz-border-radius2px;
    border-radius2px;
    background-colorwhite;
    }
    </
    style>
    </
    head>

    <
    body>
    <
    form method="post" action="" class="domainsearch" id="domain-checker">
    <
    fieldset>
    <
    p>
    <
    input type="text" id="dsearch" value="" name="sld" />
    <
    select id="dsearch" name="tld" multiple="multiple">
    <
    option value=".com" label=".com">.com</option>
    <
    option value=".asia" label=".asia">.asia</option>
    <
    option value=".biz" label=".biz">.biz</option>
    <
    option value=".bz" label=".bz">.bz</option>
    <
    option value=".ca" label=".ca">.ca</option>
    <
    option value=".cc" label=".cc">.cc</option>
    <
    option value=".de" label=".de">.de</option>
    <
    option value=".es" label=".es">.es</option>
    <
    option value=".eu" label=".eu">.eu</option>
    <
    option value=".in" label=".in">.in</option>
    <
    option value=".info" label=".info">.info</option>
    <
    option value=".me" label=".me">.me</option>
    <
    option value=".mobi" label=".mobi">.mobi</option>
    <
    option value=".name" label=".name">.name</option>
    <
    option value=".net" label=".net">.net</option>
    <
    option value=".org" label=".org">.org</option>
    <
    option value=".ru" label=".ru">.ru</option>
    <
    option value=".tel" label=".tel">.tel</option>
    <
    option value=".tv" label=".tv">.tv</option>
    <
    option value=".us" label=".us">.us</option>
    <
    option value=".ws" label=".ws">.ws</option>
    <
    option value=".xxx" label=".xxx">.xxx</option>
    </
    select>
    <
    button class="button large dsearch" type="submit"><span>Search</span></button>
    </
    p>
    </
    fieldset>
    </
    form>

    <
    script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <
    script type="text/javascript">
    $(function() {
    $(
    '#domain-checker').bind('submit',function(event){
    $.
    post('{{ constant('BB_URL_API') }}guest/servicedomain/check',
    $(
    this).serialize(),
    function(
    json) {
    if(
    json.error) {
    alert(json.error.message);
    } else if(
    json.result) {
    alert('Domain is available');
    } else {
    alert('Domain is already registered');
    }
    }, 
    'json');
    return 
    false;
    });
    });
    </
    script>
    </
    body>
    </
    html>
    (I just added the "multiple" attribute to the select tag, which also changes the appearance.)

    If this is unsupported by the API, I expect it to choose one of the selected domains and not search the others, so try different domains selected with many names that are available in some, but not all, like I mention above, to make sure the results are accurate.

    If that works when multiple domains are selected, I can convert it to checkboxes. Otherwise, documentation for the API would help me know what to try, so I'm not shooting in the dark.

    If we can't find obvious support for searching multiple domains, another option is to modify the JavaScript so that mulitple requests may be submitted: One request would be submitted for each selected checkbox, and the results of all requests would be summarized in the resulting message box. This would be a hack, and could cause problems, for instance, if there is a limit on the number of requests allowed per user. It would be better, and probably easier, to use the API, if support for multiple domain searches can be found.
     
    Last edited: Aug 6, 2013
  6. SynBorg

    SynBorg Private E-2

    Hello PC-XT

    - I copied a code to existing file,
    and nothing actually is changed.
    Stillm there is drop down list.
    and there is not way to select multiple domains.
    or i something screw up. :(



    -Currently ordering domains look like this:
    http://demo.boxbilling.com/order/domain-checker

    - What i need is domain search look as this:
    http://www.1and1.com/domain-names
    -People able to checkbox one domain and search it
    -People able to checkbox multiple domains and search it.

    Please, ifu want, i can give you full login data and access on system,
    let me know your prefferable ways of communication,
    email, or skype etc.



    Regards
     
  7. PC-XT

    PC-XT Master Sergeant

    Giving the url let me see how the API is used and test it. I didn't find support for multiple domain searches, but looking at the other ways the API is used, the second method seemed ok, so here it is to test:
    PHP:
    <!DOCTYPE html>
    <
    html>
    <
    head>
    <
    title>Check domain</title>
    <
    meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <
    style type="text/css">
    body margin0; }
    form {
    border1px solid #D1D1D1;
    }
    fieldset {
    border0px;
    }
    legend {
    padding-top15px;
    }
    {
    margin0px;
    }
    textareaselectinput {
    border1px solid #D1D1D1;
    padding5px;
    -
    webkit-border-radius2px;
    -
    moz-border-radius2px;
    border-radius2px;
    background-colorwhite;
    }
    </
    style>
    </
    head>

    <
    body>
    <
    form method="post" action="" class="domainsearch" id="domain-checker">
    <
    fieldset>
    <
    table><tr><td>
    <
    input type="text" id="dsearch" value="" name="sld" />
    </
    td><td>
    <
    div>
    <
    label title=".com"><input type="checkbox" name="tld" value=".com">.com</label>
    <
    label title=".asia"><input type="checkbox" name="tld" value=".asia">.asia</label>
    <
    label title=".biz"><input type="checkbox" name="tld" value=".biz">.biz</label>
    <
    label title=".bz"><input type="checkbox" name="tld" value=".bz">.bz</label>
    <
    label title=".ca"><input type="checkbox" name="tld" value=".ca">.ca</label>
    <
    label title=".cc"><input type="checkbox" name="tld" value=".cc">.cc</label>
    <
    label title=".de"><input type="checkbox" name="tld" value=".de">.de</label>
    <
    br />
    <
    label title=".es"><input type="checkbox" name="tld" value=".es">.es</label>
    <
    label title=".eu"><input type="checkbox" name="tld" value=".eu">.eu</label>
    <
    label title=".in"><input type="checkbox" name="tld" value=".in">.in</label>
    <
    label title=".info"><input type="checkbox" name="tld" value=".info">.info</label>
    <
    label title=".me"><input type="checkbox" name="tld" value=".me">.me</label>
    <
    label title=".mobi"><input type="checkbox" name="tld" value=".mobi">.mobi</label>
    <
    label title=".name"><input type="checkbox" name="tld" value=".name">.name</label>
    <
    br />
    <
    label title=".net"><input type="checkbox" name="tld" value=".net">.net</label>
    <
    label title=".org"><input type="checkbox" name="tld" value=".org">.org</label>
    <
    label title=".ru"><input type="checkbox" name="tld" value=".ru">.ru</label>
    <
    label title=".tel"><input type="checkbox" name="tld" value=".tel">.tel</label>
    <
    label title=".tv"><input type="checkbox" name="tld" value=".tv">.tv</label>
    <
    label title=".us"><input type="checkbox" name="tld" value=".us">.us</label>
    <
    label title=".ws"><input type="checkbox" name="tld" value=".ws">.ws</label>
    <
    label title=".xxx"><input type="checkbox" name="tld" value=".xxx">.xxx</label>
    </
    div>
    </
    td><td>
    <
    button class="button large dsearch" type="submit"><span>Search</span></button>
    </
    td></tr></table>
    </
    fieldset>
    <
    textarea id="Results" rows="5" style="width:100%">Results of the search will display here.</textarea>
    </
    form>

    <
    script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <
    script type="text/javascript">
    $(function() {
        $(
    '#domain-checker').bind('submit',function(event){
            var 
    f=document.getElementById("domain-checker"),tlds=f.tld,sld=f.sld.value;
            
    document.getElementById("Results").value="Results:";
            for(var 
    i=0;i<tlds.length;i++)if(tlds[i].checked)queryAPI(sld,tlds[i].value);
            return 
    false;
        });
        function 
    queryAPI(sld,tld){
            $.
    post('{{ constant('BB_URL_API') }}guest/servicedomain/check',
                { 
    sldsldtldtld },
                function(
    json) {
                    
    reportResult(sld,tld,json.result,json.error);
                }, 
    'json'
            
    );
        }
        function 
    reportResult(sld,tld,json){
            
    document.getElementById("Results").value+="\n"+sld+tld+": "+(json.error?"ERROR - "+json.error.message:json.result?"Available":"Domain is already registered");
        }
    });
    </
    script>
    </
    body>
    </
    html>
    It just puts the results in a text element, but you could use a list or something else if you prefer, or only list available domains, for instance, by customizing reportResult().

    If a problem comes up, feel free to let me know. :)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds