function fillCategory(){ // this function is used to fill the category list on load addOption(document.f2.category, 'SC', 'SC');addOption(document.f2.category, 'ST', 'ST');addOption(document.f2.category, 'Christian', 'Christian');addOption(document.f2.category, 'SC- Christian', 'SC- Christian');addOption(document.f2.category, 'Other', 'Other');addOption(document.f2.category, 'BC', 'BC');} // end of JS function function SelectSubCat(){ // ON or after selection of category this function will work removeAllOptions(document.f2.subcat); //addOption(document.f2.subcat, "", "select", ""); // Collect all element of subcategory for various cat_id if(document.f2.category.value == 'abc'){}if(document.f2.category.value == 'Adi Andhra'){}if(document.f2.category.value == 'BC'){}if(document.f2.category.value == 'BC.C'){}if(document.f2.category.value == 'Christian'){}if(document.f2.category.value == 'Madiga'){}if(document.f2.category.value == 'Madiga Das'){}if(document.f2.category.value == 'Madiga Dasari'){}if(document.f2.category.value == 'Mala '){}if(document.f2.category.value == 'Mala Das '){}if(document.f2.category.value == 'Mala Dasari '){}if(document.f2.category.value == 'Other'){addOption(document.f2.subcat,'abc', 'abc');}if(document.f2.category.value == 'Relli '){}if(document.f2.category.value == 'SC'){addOption(document.f2.subcat,'Adi Andhra', 'Adi Andhra');addOption(document.f2.subcat,'Madiga', 'Madiga');addOption(document.f2.subcat,'Madiga Das', 'Madiga Das');addOption(document.f2.subcat,'Madiga Dasari', 'Madiga Dasari');addOption(document.f2.subcat,'Mala ', 'Mala ');addOption(document.f2.subcat,'Mala Das ', 'Mala Das ');addOption(document.f2.subcat,'Mala Dasari ', 'Mala Dasari ');addOption(document.f2.subcat,'Relli ', 'Relli ');addOption(document.f2.subcat,'Willing to Marry SC ', 'Willing to Marry SC ');addOption(document.f2.subcat,'BC.C', 'BC.C');}if(document.f2.category.value == 'SC- Christian'){}if(document.f2.category.value == 'ST'){}if(document.f2.category.value == 'Willing to Marry SC '){}} ////////////////// function removeAllOptions(selectbox) { var i; for(i=selectbox.options.length-1;i>=0;i--) { //selectbox.options.remove(i); selectbox.remove(i); } } function addOption(selectbox, value, text ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); }