i have 7 textbox and i want to validate as Required field OnClientClick click of a button named as Update so is there any way i could do it using Javascript i have tried this code but it's not working as one of them ps: i am new to JS
function fnCheck(val) {
var v = val.id.split('_')[1];
var merter = document.getElementById('GridSubMeter_' + v + '_txtMeterIdn').value.trim();
var Billper = document.getElementById('GridSubMeter_' + v + '_txBillPer').value.trim()
var Endkwh = document.getElementById('GridSubMeter_' + v + '_txEndKwh').value.trim();
var startkwh = document.getElementById('GridSubMeter_' + v + '_txStartKwh').value.trim();
var ReadEndDate = document.getElementById('GridSubMeter_' + v + '_txReadEndDate').value.trim();
var ReadStartDate = document.getElementById('GridSubMeter_' + v + '_txReadStartDate').value.trim();
var CTFACT = document.getElementById('GridSubMeter_' + v + '_txCTFact').value.trim();
if (merter != '') {
return true;
}
else {
alert("Meter Identifier is Required Field");
return false;
}
if (Billper != '') {
return true;
}
else {
alert("Bill Period is Required Field");
return false;
}
if (Endkwh != '') {
return true;
}
else {
alert("EndKwh is Required Field");
return false;
}
if (startkwh != '') {
return true;
}
else {
alert("StartKwh is Required Field");
return false;
}
if (ReadEndDate != '') {
return true;
}
else {
alert("Read EndDate is Required Field");
return false;
}
if (ReadStartDate != '') {
return true;
}
else {
alert("Read StartDate is Required Field");
return false;
}
if (CTFACT != '') {
return true;
}
else
{ alert("CT Factor is Required Field");
return false;
}
}
<asp:Button ID="btn_Update" Style="background-color: #B2DE94; width: 40px" CausesValidation="false" runat="server" OnClientClick="fnCheck(this);" Text="Update" CommandName="Update" />

