You must Sign In to post a response.
  • Category: JavaScript

    how to use checked, selected property for dropdownlist,checkboxlist,radiobuttonlist in javascript

    hi
    how to use checked, selected property for dropdownlist,checkboxlist,radiobuttonlist dotnet controls in javascript
  • #172465
    Check this it might be helpful

    http://www.geekpedia.com/tutorial40_ListBox-and-CheckedListBox.html

  • #211255
    function Validation()
    {



    if(document.getElementById("Txt_Store_Name").value=="")
    {
    error_name.innerHTML = "Enter Store name";

    document.getElementById("Txt_Store_Name").focus();
    return(false);
    }

    else
    {
    error_name.innerHTML = "";

    }

    if(document.getElementById("Select1").value=="Select Stock Type")
    {
    error_type1.innerHTML="Select Store Type";
    document.getElementById("Select1").focus();
    return(false);
    }
    else
    {
    error_type1.innerHTML="";
    }
    if(document.getElementById("Select1").value=="Others")
    {
    if(document.getElementById("Txt_OTHER_Store_Type").value=="")
    {
    error_type2.innerHTML= "Enter Other Store Type ";
    document.getElementById("Txt_OTHER_Store_Type").focus();
    return(false);
    }
    }
    else
    {

    error_type2.innerHTML= "";
    }

    if(document.getElementById("Txt_Contact_Person").value=="")
    {
    error_cp.innerHTML = "Enter Contact Person";

    document.getElementById("Txt_Contact_Person").focus();
    return(false);
    }
    else
    {
    error_cp.innerHTML = "";
    }
    if(document.getElementById("Txt_Store_Address").value=="")
    {
    error_address.innerHTML = "Enter Contact Address ";

    document.getElementById("Txt_Store_Address").focus();
    return(false);
    }
    else
    {
    error_address.innerHTML = "";
    }

    if(document.getElementById("Txt_Store_Address").value=="")
    {
    error_address.innerHTML ="Enter Address ";
    document.getElementById("Txt_Store_Address").focus();
    return(false);
    }
    else
    {
    error_address.innerHTML ="";

    }
    if(document.getElementById("Txt_Store_Phone_STD").value=="")
    {
    error_phoneSTD.innerHTML ="Enter STD Code ";

    document.getElementById("Txt_Store_Phone_STD").focus();
    return(false);
    }

    else
    {
    error_phoneSTD.innerHTML ="";
    }

    if(document.getElementById("Txt_Store_Phone_NUMBER").value=="")
    {
    error_phone1.innerHTML = ("Enter Phone Number");
    document.getElementById("Txt_Store_Phone_NUMBER").focus();
    return(false);
    }
    else
    {
    error_phone1.innerHTML = ("");
    }
    if(document.getElementById("Txt_Store_FAX_STD").value=="")
    {
    error_FaxSTD.innerHTML =("Enter Fax STD");
    document.getElementById("Txt_Store_FAX_STD").focus();
    return(false);
    }

    else
    {
    error_FaxSTD.innerHTML =("");

    }
    if(document.getElementById("Txt_Store_FAX_NUMBER").value=="")
    {
    error_faxNo.innerHTML ="Enter FAX Number";
    document.getElementById("Txt_Store_FAX_NUMBER").focus();
    return(false);
    }
    else
    {
    error_faxNo.innerHTML ="";
    }
    if(document.getElementById("TXT_STORE_MOBILE_NUMBER").value=="")
    {
    error_mobile.innerHTML ="Enter Mobile Number";
    document.getElementById("TXT_STORE_MOBILE_NUMBER").focus();
    return(false);
    }
    else
    {
    error_mobile.innerHTML ="";
    }




    function checkDomain(nname)
    {
    var arr = new Array(
    '.com','.net','.org','.biz','.coop','.info','.museum','.name',
    '.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
    '.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
    '.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
    '.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
    '.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
    '.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
    '.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
    '.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
    '.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
    '.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
    '.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
    '.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
    '.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
    '.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
    '.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
    '.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
    '.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
    '.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
    '.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
    '.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
    '.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
    '.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
    '.wf','.ye','.yt','.yu','.za','.zm','.zw');

    var mai = nname;
    var val = true;

    var dot = mai.lastIndexOf(".");
    var dname = mai.substring(0,dot);
    var ext = mai.substring(dot,mai.length);
    //alert(ext);

    if(dot>2 && dot<57)
    {
    for(var i=0; i<arr.length; i++)
    {
    if(ext == arr[i])
    {
    val = true;
    break;
    }
    else
    {
    val = false;
    }
    }
    if(val == false)
    {
    error_website.innerHTML="Your domain extension "+ext+" is not correct";
    return false;
    }
    else
    {
    for(var j=0; j<dname.length; j++)
    {
    var dh = dname.charAt(j);
    var hh = dh.charCodeAt(0);
    if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
    {
    if((j==0 || j==dname.length-1) && hh == 45)
    {
    error_website.innerHTML=("Domain name should not begin are end with '-'");
    return false;
    }
    }
    else {
    error_website.innerHTML=("Your domain name should not have special characters");
    return false;
    }
    }
    }
    }
    else
    {
    error_website.innerHTML=("Your Domain name is too short/long");
    return false;
    }
    error_website.innerHTML=("");
    return true;
    }



    and Use Like:



    <input id="BTN_SUBMIT" class="JobPortalButton"
    type="submit" value="Submit" onclick=" return Validation();" onserverclick="Button2_ServerClick" runat="server"/>

    RAM SINGH
    E-mail: ramsinghmscit@gmail.com
    Mobile:+91-8427242201

    Pan Card No: BIRPS8805H


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.