Click here to Skip to main content
15,063,275 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having some textboxes and dropdowns inside the updatepanel. I used required field validators to validate them ,Due to visiblity Changes of textbox and dropdown i used javascript to validate through Page_ClientValidate, validations are working fine but the problem is while javascript returns false,clicking on buttons nothing is happend,Again it needs the click to trigger. Below is the js code

function AddOrUpdateItemValidation() {
var ddlSelectType = document.getElementById('<%=ddlSelectType.ClientID %>');
var ddlSelectTypeValue = ddlSelectType.options[ddlSelectType.selectedIndex].value;
var ddlWorkFlowProject = document.getElementById('<%=ddlWorkFlowProject.ClientID %>');
var ddlWorkFlowProjectValue = ddlWorkFlowProject.options[ddlWorkFlowProject.selectedIndex].value;
var isvalid = false;

if (ddlWorkFlowProjectValue == 0) {
fnNotify('Select Project Name!');
}
else if (ddlSelectTypeValue == 0) {
fnNotify('Select Any One Type!');
}
else if (ddlSelectTypeValue == 1) {
if (Page_ClientValidate("ForHeadingType")) {
isvalid = true;
}
}
else if (ddlSelectTypeValue == 2) {
if (Page_ClientValidate("ForHeadingType")) {
if (Page_ClientValidate("ForTaskType")) {
var ddlSelectmeasure = document.getElementById('<%=ddlSelectmeasure.ClientID %>');
var ddlSelectmeasureTypeValue = ddlSelectmeasure.options[ddlSelectmeasure.selectedIndex].value;
if (ddlSelectmeasureTypeValue == 1) {
if (Page_ClientValidate("ForFormCheck")) {
var ddlSelectForm = document.getElementById('<%=ddlSelectForm.ClientID %>');
var ddlSelectFormValue = ddlSelectForm.options[ddlSelectForm.selectedIndex].value;
if (ddlSelectFormValue == 6 | ddlSelectFormValue == 8 | ddlSelectFormValue == 9) {
if (Page_ClientValidate("BasedOnForm")) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
else if (ddlSelectCategoryValue != 0) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
}
else if (ddlSelectmeasureTypeValue == 2) {
if (Page_ClientValidate("ForDataCheck")) {
var ddlSelectPage = document.getElementById('<%=ddlSelectPage.ClientID %>');
var ddlSelectPageValue = ddlSelectPage.options[ddlSelectPage.selectedIndex].value;
if (ddlSelectPageValue == 1) {
if (Page_ClientValidate("BasedOnPage")) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
else if (ddlSelectPageValue != 0) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
else if (ddlSelectmeasureTypeValue == 3 | ddlSelectmeasureTypeValue == 4) {
if (Page_ClientValidate("ForMemberCheck")) {
var ddlSelectCategory = document.getElementById('<%=ddlSelectCategory.ClientID %>');
var ddlSelectCategoryValue = ddlSelectCategory.options[ddlSelectCategory.selectedIndex].value;
if (ddlSelectCategoryValue == 1 | ddlSelectCategoryValue == 2 | ddlSelectCategoryValue == 3) {
if (Page_ClientValidate("BasedonCategory")) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
else if (ddlSelectCategoryValue != 0) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
}
else if (ddlSelectmeasureTypeValue == 5) {
if (Page_ClientValidate("ForTeamMeetCheck")) {
var ddlPWSelectType = document.getElementById('<%=ddlPWSelectType.ClientID %>');
var ddlPWSelectTypeValue = ddlPWSelectType.options[ddlPWSelectType.selectedIndex].value;
if (ddlPWSelectTypeValue == 1 | ddlPWSelectTypeValue == 2 | ddlPWSelectTypeValue == 3) {
if (Page_ClientValidate("BasedOnPWType")) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
else if (ddlPWSelectTypeValue != 0) {
if (Page_ClientValidate("ForTaskcheckType")) {
if (Page_ClientValidate("ForTaskcheckTxtValue")) {
if (Page_ClientValidate("ForTaskcheckDisplayResult")) {
isvalid = true;
}
}
}
}
}
}
}
}
}
return isvalid;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900