Use jquery to validate the fields that either they are filled or not. Just to check if field has some value then return to be true and if it is not filled then return it to false and show the error message on screen. I have used bootstrap error alert message with listing of all error messages. I have created an array and pushing all that fields in array that are empty. and displaying the array at the end.
Here is code that elaborates completely.

function addsecOrgRow()
{
var sec_Org_name =$(“[name=sec_org_name]”).val();
var sec_Org_tel_no =$(“[name=sec_org_tel_no]”).val();
var sec_Org_mob_no =$(“[name=sec_Org_mob_no]”).val();
var sec_Org_address=$(“[name=sec_org_address]”).val();
var sec_Org_fax_no=$(“[name=sec_org_fax_no]”).val();
var sec_Org_email=$(“[name=sec_org_email]”).val();

var errArray = new Array();
if(sec_Org_name == ”){
errArray.push(“Organization Name”);
}
if(sec_Org_tel_no == ”){
errArray.push(“Tel No”);
}
if(sec_Org_mob_no == ”){
errArray.push(“Mobile No”);
}
if(sec_Org_address == ”){
errArray.push(“Address”);
}
if(sec_Org_fax_no == ”){
errArray.push(“Fax No”);
}
if(sec_Org_email == ”){
errArray.push(“Email Address”);
}

var err = ‘Following Fields are empty: </br> ‘;
if(errArray.length != 0) {
for (i = 0; i < errArray.length; i++) { 
err += errArray[i];
if(i < errArray.length-1){
err += ‘, ‘;
}
}

bootstrap_alert.warning(err,’weapon_alert’);
//alert(err);
return false;


Function is called on click of button. 
If there is any issue then please write in comments. Our team will respond you soon.

Leave a Reply

Your email address will not be published. Required fields are marked *