//----------------------------------------------------------------------------- // Javascript source for validating the Item form. // (c) Palnar Transmedia Pvt. Ltd., 2007. // Author: Vinod // Modified Date: 18.October.2007 //----------------------------------------------------------------------------- var whitespace = " \t\n\r"; var addressValidate = false; var validateBModel = false; function disableFormFields(){ document.forms['ItemForm'].itemTitle.disabled = "true"; document.forms['ItemForm'].categoryId.disabled = "true"; document.getElementById('deptList').disabled = "true"; document.getElementById('catRTE').disabled = "true"; document.getElementById('deptRTE').disabled = "true"; document.forms['ItemForm'].unitPrice.disabled = "true"; document.forms['ItemForm'].normalShpgChrge.disabled = "true"; } function ItemFormPreview(){ //alert("ItemFormPreview validateAddItem.."); var fs = false; // free shipping var ns = false; // no shipping var ShippingDetails= document.forms['ItemForm'].shippingDetails.value; var Title= document.forms['ItemForm'].itemTitle.value; var catDesc = document.forms['ItemForm'].elements['categoryId'][document.forms['ItemForm'].elements['categoryId'].selectedIndex].innerHTML; //alert("catDesc : "+catDesc); //var deptDesc = document.forms['ItemForm'].elements['depts'][document.forms['ItemForm'].elements['departmentId'].selectedIndex].innerHTML; //alert("1. dept value: "+document.forms['ItemForm'].departmentId.value); //alert("2. dept name : "+document.forms['ItemForm'].departmentId.name); //alert("3. deptDesc name : "+deptDesc); var country = document.forms['ItemForm'].elements['countryName'][document.forms['ItemForm'].elements['countryName'].selectedIndex].innerHTML; var UnitPrice = document.forms['ItemForm'].unitPrice.value; var Categories = document.forms['ItemForm'].categoryId.value; //alert("getEleByName: "+document.getElementByName("departmentId").selectedValue); var Departments = document.forms['ItemForm'].departmentId.value; //alert("Departments: "+Departments); var NormalShpgChrge = document.forms['ItemForm'].normalShpgChrge.value; //var QtySoh = document.forms['ItemForm'].qtySoh.value; //var ExpidatedShpgChrge = document.forms['ItemForm'].expidatedShpgChrge.value; var checkBoxImage = document.forms['ItemForm'].primaryImage; //var RetAddress1 = document.forms['ItemForm'].retAddress1; //var RetCity = document.forms['ItemForm'].retCity; //var RetState = document.forms['ItemForm'].retState; //var RetZip = document.forms['ItemForm'].retZip; /*modified by sumesh on 8-9-2009*/ //var ItemLocation = document.forms['ItemForm'].itemLocation; /*end*/ /*modified by sumesh on 16-9-2009*/ //if(checkBoxImage != null && checkBoxImage.length > 0){ // var checkbox_choices = 0; //for (counter = 0; counter < document.forms['ItemForm'].primaryImage.length; counter++) //{ //if (document.forms['ItemForm'].primaryImage[counter].checked) // { //checkbox_choices = checkbox_choices + 1; // } // } //if (checkbox_choices > 1 ) //{ // alert('You can select ONE LIST IMAGE Only'); // return false; //} // if (checkbox_choices < 1 ) //{ // alert('You are in need to select ONE LIST IMAGE'); //return false; //} //} /*end*/ if(Title.length <=0 || isWhitespace(Title)) { alert('Item Title Is required'); document.forms['ItemForm'].itemTitle.focus();return(false) } updateRTE('itemDescScript'); updateRTE('shpDetailsScript'); var Description= document.forms['ItemForm'].itemDescScript.value; if(Description.length <=0 || isWhitespace(Description)) { alert('Description Is required'); document.forms['ItemForm'].itemDescScript.focus();return(false) } //if(Description.length > 5000 ) //{ // alert('Description Cant Exceed More than 5000 Characters'); // document.forms['ItemForm'].itemDesc.focus();return(false) //} //if(ShippingDetails.length > 200 ) //{ // alert('Shipping Details Cant Exceed More than 200 Characters'); // document.forms['ItemForm'].shippingDetails.focus();return(false) //} if(catDesc == "Select") { alert('Category Is required'); document.forms['ItemForm'].categoryId.focus();return(false) } if(catDesc == "Electronics") { // alert("brandmodel" +document.getElementById('bModel').value); if(document.forms['ItemForm'].brandModel.value == "" || isWhitespace(document.forms['ItemForm'].brandModel.value)){ alert('Enter the Brand Model'); document.forms['ItemForm'].brandModel.focus();return(false) } } //} //if(deptDesc == "Select" && catDesc != "Select" && catDesc != "Others"){ // alert('Sub Category Is required'); // document.forms['ItemForm'].departmentId.focus();return(false) //} //if(document.forms['ItemForm'].brandModel != null){ //if(document.forms['ItemForm'].brandModel.focus == true) // { //} //} if(country == "Select") { alert('Country Is required'); document.forms['ItemForm'].countryName.focus();return(false) } if(UnitPrice.length <=0 || UnitPrice == 0.0 || UnitPrice == 0) { alert('Enter the Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); } /* for (i = 0; i < UnitPrice.length; i++) { // Check that current character is number. var c = UnitPrice.charAt(i); if (((c < "0") || (c > "9")) ) { alert('Enter Integer Value for Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); return false; } } */ if(country == "US") { var Zip = document.forms['ItemForm'].zipCode.value; for (i = 0; i < Zip.length; i++) { // Check that current character is number. var c = Zip.charAt(i); if (((c < "0") || (c > "9"))) { alert('Enter Integer Value for ZipCode'); document.forms['ItemForm'].zipCode.focus();return(false) } } } //modifed by sumesh on 12-10-2009 //end var freeShipping = false; var noShipping = false; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ if(document.forms['ItemForm'].elements['freeShipping'][i].value == "fs") { freeShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } else if(document.forms['ItemForm'].elements['freeShipping'][i].value == "ns") { noShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } } if(freeShipping == false && noShipping == false){ if(NormalShpgChrge.length <=0 || NormalShpgChrge == 0.0 || NormalShpgChrge == 0) { alert('Enter the Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } for (i = 0; i < NormalShpgChrge.length; i++) { // Check that current character is number. var c = NormalShpgChrge.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } } } document.forms['ItemForm'].submit(); return true; } function ItemForm1(){ //alert("ItemForm1 validateAddItem.."); var fs = false; // free shipping var ns = false; // no shipping var ShippingDetails= document.forms['ItemForm'].shippingDetails.value; var Title= document.forms['ItemForm'].itemTitle.value; var catDesc = document.forms['ItemForm'].elements['categoryId'][document.forms['ItemForm'].elements['categoryId'].selectedIndex].innerHTML; //alert("catDesc : "+catDesc); //var deptDesc = document.forms['ItemForm'].elements['depts'][document.forms['ItemForm'].elements['departmentId'].selectedIndex].innerHTML; //alert("1. dept value: "+document.forms['ItemForm'].departmentId.value); //alert("2. dept name : "+document.forms['ItemForm'].departmentId.name); //alert("3. deptDesc name : "+deptDesc); var country = document.forms['ItemForm'].elements['countryName'][document.forms['ItemForm'].elements['countryName'].selectedIndex].innerHTML; var UnitPrice = document.forms['ItemForm'].unitPrice.value; var Categories = document.forms['ItemForm'].categoryId.value; //alert("getEleByName: "+document.getElementByName("departmentId").selectedValue); var Departments = document.forms['ItemForm'].departmentId.value; //alert("Departments: "+Departments); var NormalShpgChrge = document.forms['ItemForm'].normalShpgChrge.value; // var QtySoh = document.forms['ItemForm'].qtySoh.value; //var ExpidatedShpgChrge = document.forms['ItemForm'].expidatedShpgChrge.value; var checkBoxImage = document.forms['ItemForm'].primaryImage; //var RetAddress1 = document.forms['ItemForm'].retAddress1; //var RetCity = document.forms['ItemForm'].retCity; //var RetState = document.forms['ItemForm'].retState; //var RetZip = document.forms['ItemForm'].retZip; /*modified by sumesh on 8-9-2009*/ //var ItemLocation = document.forms['ItemForm'].itemLocation; /*end*/ /*modified by sumesh on 16-9-2009*/ //if(checkBoxImage != null && checkBoxImage.length > 0){ // var checkbox_choices = 0; //for (counter = 0; counter < document.forms['ItemForm'].primaryImage.length; counter++) //{ //if (document.forms['ItemForm'].primaryImage[counter].checked) // { //checkbox_choices = checkbox_choices + 1; // } // } //if (checkbox_choices > 1 ) //{ // alert('You can select ONE LIST IMAGE Only'); // return false; //} // if (checkbox_choices < 1 ) //{ // alert('You are in need to select ONE LIST IMAGE'); //return false; //} //} /*end*/ if(Title.length <=0 || isWhitespace(Title)) { alert('Item Title Is required'); document.forms['ItemForm'].itemTitle.focus();return(false) } updateRTE('itemDescScript'); updateRTE('shpDetailsScript'); var Description= document.forms['ItemForm'].itemDescScript.value; if(Description.length <=0 || isWhitespace(Description)) { alert('Description Is required'); document.forms['ItemForm'].itemDescScript.focus();return(false) } //if(Description.length > 5000 ) //{ // alert('Description Cant Exceed More than 5000 Characters'); // document.forms['ItemForm'].itemDesc.focus();return(false) //} //if(ShippingDetails.length > 200 ) //{ // alert('Shipping Details Cant Exceed More than 200 Characters'); // document.forms['ItemForm'].shippingDetails.focus();return(false) //} if(catDesc == "Select") { alert('Category Is required'); document.forms['ItemForm'].categoryId.focus();return(false) } if(catDesc == "Electronics") { // alert("brandmodel" +document.getElementById('bModel').value); if(document.forms['ItemForm'].brandModel.value == "" || isWhitespace(document.forms['ItemForm'].brandModel.value)){ alert('Enter the Brand Model'); document.forms['ItemForm'].brandModel.focus();return(false) } } //} //if(deptDesc == "Select" && catDesc != "Select" && catDesc != "Others"){ // alert('Sub Category Is required'); // document.forms['ItemForm'].departmentId.focus();return(false) //} //if(document.forms['ItemForm'].brandModel != null){ //if(document.forms['ItemForm'].brandModel.focus == true) // { //} //} if(country == "Select") { alert('Country Is required'); document.forms['ItemForm'].countryName.focus();return(false) } if(UnitPrice.length <=0 || UnitPrice == 0.0 || UnitPrice == 0) { alert('Enter the Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); } /* for (i = 0; i < UnitPrice.length; i++) { // Check that current character is number. var c = UnitPrice.charAt(i); if (((c < "0") || (c > "9")) ) { alert('Enter Integer Value for Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); return false; } } */ if(country == "US") { var Zip = document.forms['ItemForm'].zipCode.value; for (i = 0; i < Zip.length; i++) { // Check that current character is number. var c = Zip.charAt(i); if (((c < "0") || (c > "9"))) { alert('Enter Integer Value for ZipCode'); document.forms['ItemForm'].zipCode.focus();return(false) } } } //modifed by sumesh on 12-10-2009 //end var freeShipping = false; var noShipping = false; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ if(document.forms['ItemForm'].elements['freeShipping'][i].value == "fs") { freeShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } else if(document.forms['ItemForm'].elements['freeShipping'][i].value == "ns") { noShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } } if(freeShipping == false && noShipping == false){ if(NormalShpgChrge.length <=0 || NormalShpgChrge == 0.0 || NormalShpgChrge == 0) { alert('Enter the Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } for (i = 0; i < NormalShpgChrge.length; i++) { // Check that current character is number. var c = NormalShpgChrge.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } } } document.forms['ItemForm'].submit(); return true; } function ItemForm3(){ //alert("ItemForm1 .TTTT.."); var fs = false; // free shipping var ns = false; // no shipping var ShippingDetails= document.forms['ItemForm'].shippingDetails.value; var Title= document.forms['ItemForm'].itemTitle.value; var catDesc = document.forms['ItemForm'].elements['categoryId'][document.forms['ItemForm'].elements['categoryId'].selectedIndex].innerHTML; //alert("catDesc : "+catDesc); //var deptDesc = document.forms['ItemForm'].elements['depts'][document.forms['ItemForm'].elements['departmentId'].selectedIndex].innerHTML; //alert("1. dept value: "+document.forms['ItemForm'].departmentId.value); //alert("2. dept name : "+document.forms['ItemForm'].departmentId.name); //alert("3. deptDesc name : "+deptDesc); var country = document.forms['ItemForm'].elements['countryName'][document.forms['ItemForm'].elements['countryName'].selectedIndex].innerHTML; var UnitPrice = document.forms['ItemForm'].unitPrice.value; var Categories = document.forms['ItemForm'].categoryId.value; //alert("getEleByName: "+document.getElementByName("departmentId").selectedValue); var Departments = document.forms['ItemForm'].departmentId.value; //alert("Departments: "+Departments); var NormalShpgChrge = document.forms['ItemForm'].normalShpgChrge.value; // var QtySoh = document.forms['ItemForm'].qtySoh.value; //var ExpidatedShpgChrge = document.forms['ItemForm'].expidatedShpgChrge.value; var checkBoxImage = document.forms['ItemForm'].primaryImage; //var RetAddress1 = document.forms['ItemForm'].retAddress1; //var RetCity = document.forms['ItemForm'].retCity; //var RetState = document.forms['ItemForm'].retState; //var RetZip = document.forms['ItemForm'].retZip; /*modified by sumesh on 8-9-2009*/ //var ItemLocation = document.forms['ItemForm'].itemLocation; /*end*/ /*modified by sumesh on 16-9-2009*/ //if(checkBoxImage != null && checkBoxImage.length > 0){ // var checkbox_choices = 0; //for (counter = 0; counter < document.forms['ItemForm'].primaryImage.length; counter++) //{ //if (document.forms['ItemForm'].primaryImage[counter].checked) // { //checkbox_choices = checkbox_choices + 1; // } // } //if (checkbox_choices > 1 ) //{ // alert('You can select ONE LIST IMAGE Only'); // return false; //} // if (checkbox_choices < 1 ) //{ // alert('You are in need to select ONE LIST IMAGE'); //return false; //} //} /*end*/ if(Title.length <=0 || isWhitespace(Title)) { alert('Item Title Is required'); document.forms['ItemForm'].itemTitle.focus();return(false) } updateRTE('itemDescScript'); updateRTE('shpDetailsScript'); var Description= document.forms['ItemForm'].itemDescScript.value; if(Description.length <=0 || isWhitespace(Description)) { alert('Description Is required'); document.forms['ItemForm'].itemDescScript.focus();return(false) } //if(Description.length > 5000 ) //{ // alert('Description Cant Exceed More than 5000 Characters'); // document.forms['ItemForm'].itemDesc.focus();return(false) //} //if(ShippingDetails.length > 200 ) //{ // alert('Shipping Details Cant Exceed More than 200 Characters'); // document.forms['ItemForm'].shippingDetails.focus();return(false) //} if(catDesc == "Select") { alert('Category Is required'); document.forms['ItemForm'].categoryId.focus();return(false) } if(catDesc == "Electronics") { // alert("brandmodel" +document.getElementById('bModel').value); if(document.forms['ItemForm'].brandModel.value == "" || isWhitespace(document.forms['ItemForm'].brandModel.value)){ alert('Enter the Brand Model'); document.forms['ItemForm'].brandModel.focus();return(false) } } //} //if(deptDesc == "Select" && catDesc != "Select" && catDesc != "Others"){ // alert('Sub Category Is required'); // document.forms['ItemForm'].departmentId.focus();return(false) //} //if(document.forms['ItemForm'].brandModel != null){ //if(document.forms['ItemForm'].brandModel.focus == true) // { //} //} if(country == "Select") { alert('Country Is required'); document.forms['ItemForm'].countryName.focus();return(false) } if(UnitPrice.length <=0 || UnitPrice == 0.0 || UnitPrice == 0) { alert('Enter the Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); } /* for (i = 0; i < UnitPrice.length; i++) { // Check that current character is number. var c = UnitPrice.charAt(i); if (((c < "0") || (c > "9"))) { alert('Enter Integer Value for Unit Price'); document.forms['ItemForm'].unitPrice.focus();return(false); return false; } } */ if(country == "US") { var Zip = document.forms['ItemForm'].zipCode.value; for (i = 0; i < Zip.length; i++) { // Check that current character is number. var c = Zip.charAt(i); if (((c < "0") || (c > "9"))) { alert('Enter Integer Value for ZipCode'); document.forms['ItemForm'].zipCode.focus();return(false) } } } //modifed by sumesh on 12-10-2009 //end var freeShipping = false; var noShipping = false; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ if(document.forms['ItemForm'].elements['freeShipping'][i].value == "fs") { freeShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } else if(document.forms['ItemForm'].elements['freeShipping'][i].value == "ns") { noShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } } if(freeShipping == false && noShipping == false){ if(NormalShpgChrge.length <=0 || NormalShpgChrge == 0.0 || NormalShpgChrge == 0) { alert('Enter the Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } for (i = 0; i < NormalShpgChrge.length; i++) { // Check that current character is number. var c = NormalShpgChrge.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } } } //document.forms['ItemForm'].submit(); return true; } function ItemForm2() { var ShippingDetails= document.forms['ItemForm'].shippingDetails.value; var Title= document.forms['ItemForm'].itemTitle.value; var UnitPrice = document.forms['ItemForm'].unitPrice.value; //var UnitPrice1 = document.forms['ItemForm'].unitPrice1.value; var NormalShpgChrge = document.forms['ItemForm'].normalShpgChrge.value; //var ExpidatedShpgChrge = document.forms['ItemForm'].expidatedShpgChrge.value; var checkBoxImage = document.forms['ItemForm'].primaryImage; /*modified by sumesh on 8-9-2009*/ //var ItemLocation = document.forms['ItemForm'].itemLocation; /*end*/ /*modified by sumesh on 16-9-2009*/ //if(checkBoxImage != null && checkBoxImage.length > 0){ //var checkbox_choices = 0; //for (counter = 0; counter < document.forms['ItemForm'].primaryImage.length; counter++) //{ //if (document.forms['ItemForm'].primaryImage[counter].checked) // { // checkbox_choices = checkbox_choices + 1; // } //} //if (checkbox_choices > 1 ) //{ // alert('You can select ONE LIST IMAGE Only'); // return false; //} //if (checkbox_choices < 1 ) //{ // alert('You are in need to select ONE LIST IMAGE'); // return false; //} //} /*end*/ if(Title.length <=0 || isWhitespace(Title)) { alert('Item Title Is required'); document.forms['ItemForm'].itemTitle.focus();return(false) } updateRTE('itemDescScript'); var Description= document.forms['ItemForm'].itemDescScript.value; if(Description.length <=0 || isWhitespace(Description)) { alert('Description Is required'); document.forms['ItemForm'].itemDescScript.focus();return(false) } //if(Description.length > 5000 ) //{ // alert('Description Cant Exceed More than 5000 Characters'); // document.forms['ItemForm'].itemDesc.focus();return(false) //} //if(ShippingDetails.length > 200 ) //{ // alert('Shipping Details Cant Exceed More than 200 Characters'); // document.forms['ItemForm'].shippingDetails.focus();return(false) //} /* for (i = 0; i < UnitPrice.length; i++) { // Check that current character is number. var c = UnitPrice.charAt(i); if (((c < "0") || (c > "9"))) { //alert('Enter Integer Value for Unit in Price'); document.forms['ItemForm'].unitPrice.focus();return(false) } } */ //modifed by sumesh on 12-10-2009 //end for (i = 0; i < NormalShpgChrge.length; i++) { // Check that current character is number. var c = NormalShpgChrge.charAt(i); if ((((c < "0") || (c > "9")) && (c != ".")) || NormalShpgChrge == 0.0 || NormalShpgChrge == 0) { alert('Enter Correct Value for Shipping Cost'); document.forms['ItemForm'].normalShpgChrge.focus();return(false) } } document.forms['ItemForm'].submit(); return true; } function ImageValidate(){ var FileName1 = document.forms['ItemForm'].file1.value; //if(FileName1.length <= 0){ // alert('Load the Image' + FileName1); // return false; //} //alert(FileName1); var mime1 = FileName1.substring(FileName1.lastIndexOf("."),FileName1.length); //alert(mime1); if(mime1 != '.gif' && mime1 != '.jpg' && mime1 != '.jpeg' && mime1 != '.JPEG' && mime1 != '.JPG' && mime1 != '.bmp' && mime1 != "" ){ alert("Invalid Image"); document.forms['ItemForm'].file1.focus();return(false) }else{ var img = new Image(); img.src = 'file://'+FileName1; if(img.width > 5000 && img.height > 5000){ alert("image size is too large"); document.forms['ItemForm'].file1.focus();return(false) } } updateRTE('itemDescScript'); updateRTE('shpDetailsScript'); //loadBusy();return(true); //document.forms['ItemForm'].process.style.display = "inline"; //disableFormFields(); document.getElementById('process_image').style.display="inline"; //alert('dfd'); document.forms['ItemForm'].submit(); return true; } function validateRenewForm(){ var newPrice = document.forms['RenewalForm'].newUnitPrice.value; if(newPrice.length <=0 || newPrice == 0.0 || newPrice == 0) { alert('Enter the New Unit Price'); document.forms['RenewalForm'].newUnitPrice.focus();return(false) } for (i = 0; i < newPrice.length; i++) { // Check that current character is number. var c = newPrice.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for New Unit Price'); document.forms['RenewalForm'].newUnitPrice.focus();return(false) return false; } } document.forms['RenewalForm'].submit(); return true; } function validateAdvanceSearch(){ var minPrice= document.forms['advanceSearch'].minPrice.value; var maxPrice= document.forms['advanceSearch'].maxPrice.value; for (i = 0; i < minPrice.length; i++) { // Check that current character is number. var c = minPrice.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for Minimum Price'); document.forms['advanceSearch'].minPrice.focus();return(false) } } for (i = 0; i < maxPrice.length; i++) { // Check that current character is number. var c = maxPrice.charAt(i); if (((c < "0") || (c > "9")) && (c != ".")) { alert('Enter Integer Value for Maximum Price'); document.forms['advanceSearch'].maxPrice.focus();return(false) } } document.forms['advanceSearch'].submit(); return true; } //checking for white spaces function isWhitespace (s) { var i; // Is s empty? if (isEmpty(s)) return true; for (i = 0; i < s.length; i++) { // Check that current character isn't whitespace. var c = s.charAt(i); if (whitespace.indexOf(c) == -1) return false; } // All characters are whitespace. return true; } //checking whether the string is empty function isEmpty(s) { return ((s == null) || (s.length == 0)) } function chkControl(j) { var freeShipping = false; var noShipping = false; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ //alert(document.forms['ItemForm'].elements['freeShipping'][i].value); if(document.forms['ItemForm'].elements['freeShipping'][i].value == "fs") { freeShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } else if(document.forms['ItemForm'].elements['freeShipping'][i].value == "ns") //alert(document.forms['ItemForm'].elements['freeShipping'][i].value); { noShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } } //alert('freeshipping ' +freeShipping+ ' noShipping ' +noShipping); if(freeShipping == true && noShipping == false){ //alert('fs true : ns false'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = true; document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; //document.forms['ItemForm'].elements['shippingDetails'].disabled = false; document.getElementById('shpDts').style.display = "inline"; document.getElementById('shpDts1').style.display = "inline"; document.getElementById('ShChrDetailsIdRow2').style.display = "none"; document.getElementById('ShChrDetailsIdRow1').style.display = "none"; } if(noShipping == true && freeShipping == false){ //alert('fs false : ns true'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = true; document.getElementById('shpDts').style.display = "none"; document.getElementById('shpDts1').style.display = "none"; document.getElementById('ShChrDetailsIdRow1').style.display = "none"; document.getElementById('ShChrDetailsIdRow2').style.display = "none"; //document.forms['ItemForm'].elements['shippingDetails'].disabled = true; document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; document.forms['ItemForm'].elements['shippingDetails'].value = ""; } if(freeShipping == false && noShipping == false){ //alert('fs false : ns false'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = false; document.getElementById('shpDts').style.display = "inline"; document.getElementById('shpDts1').style.display = "inline"; document.getElementById('ShChrDetailsIdRow2').style.display = "inline"; document.getElementById('ShChrDetailsIdRow1').style.display = "inline"; //document.forms['ItemForm'].elements['shippingDetails'].disabled = false; document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; document.forms['ItemForm'].elements['shippingDetails'].value = ""; } var total=0; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ if(document.forms['ItemForm'].elements['freeShipping'][i].checked){ total =total +1;} //alert(total); if(total > 1){ alert("Please Select one checkbox") document.forms['ItemForm'].elements['freeShipping'][j].checked = false ; return false; } } } function chkControlpopup(j) { var freeShipping = false; var noShipping = false; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ //alert(document.forms['ItemForm'].elements['freeShipping'][i].value); if(document.forms['ItemForm'].elements['freeShipping'][i].value == "fs") { freeShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } else if(document.forms['ItemForm'].elements['freeShipping'][i].value == "ns") //alert(document.forms['ItemForm'].elements['freeShipping'][i].value); { noShipping = document.forms['ItemForm'].elements['freeShipping'][i].checked; } } //alert('freeshipping ' +freeShipping+ ' noShipping ' +noShipping); if(freeShipping == true && noShipping == false){ //alert('fs true : ns false'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = true; document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; //document.forms['ItemForm'].elements['shippingDetails'].disabled = false; document.getElementById('shpDts').style.display = "inline"; document.getElementById('shpDts1').style.display = "inline"; } if(noShipping == true && freeShipping == false){ //alert('fs false : ns true'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = true; document.getElementById('shpDts').style.display = "none"; document.getElementById('shpDts1').style.display = "none"; //document.forms['ItemForm'].elements['shippingDetails'].disabled = true; document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; document.forms['ItemForm'].elements['shippingDetails'].value = ""; } if(freeShipping == false && noShipping == false){ //alert('fs false : ns false'); document.forms['ItemForm'].elements['normalShpgChrge'].disabled = true; document.getElementById('shpDts').style.display = "inline"; document.getElementById('shpDts1').style.display = "inline"; //document.forms['ItemForm'].elements['shippingDetails'].disabled = false; //document.forms['ItemForm'].elements['normalShpgChrge'].value = ""; //document.forms['ItemForm'].elements['shippingDetails'].value = ""; } var total=0; for(var i=0; i < document.forms['ItemForm'].elements['freeShipping'].length; i++){ if(document.forms['ItemForm'].elements['freeShipping'][i].checked){ total =total +1;} //alert(total); if(total > 1){ alert("Please Select one checkbox") document.forms['ItemForm'].elements['freeShipping'][j].checked = false ; return false; } } }