CssClass="button green savensendbtn" OnClick="btnCommit_Click" OnClientClick="return ValidSave();" />
My Java Script is-
-----------
Problem is my Java Script code is not firing on Button click.
is any one have adea about this?
My Java Script is-
-----------
function ValidSave() {
if (typeof (Page_ClientValidate) === "function")
if (!Page_ClientValidate())
return false;
if ($("span[id$='lblPayPalUserMissing']").attr("IsMissing") == "true" && $("input[id*='rblPaymentMode']:checked").val() == '<%= ZippSlips.Core.Model.Enums.PaymentMode.CreditCard %>') {
$.blockUI({ message: $("div#MissingPaypalAccountError") });
return false;
}
else if ($("#liMandatoryItemError").length > 0 && $(".paymentgrid").find("input[type='radio'],input[type='checkbox']").length > 0 &&
$(".paymentgrid").find("input[type='radio']:checked,input[type='checkbox']:checked").length == 0) {
$("#liMandatoryItemError").removeClass("hide");
return false;
}
else {
return true;
}
}
Problem is my Java Script code is not firing on Button click.
is any one have adea about this?

Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 12, 2014, 10:06 PM EST
I think nothing wrong in you code.
just check whether your Js function is called or nor?
also check is your JS function reachable by your Page i.e are you define this in ASPX file or separate JS file?
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 12, 2014, 10:13 PM EST
try this
Abhineet SrivastavaRank #1,890 · 783 reputationPosted Feb 12, 2014, 11:11 PM EST
Can't remove OnClick function,it have other functionality.
Abhineet SrivastavaRank #1,890 · 783 reputationPosted Feb 12, 2014, 11:15 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 12, 2014, 11:20 PM EST
ok
you are _dopostback event.
this is also call from javascript if I am not wrong.
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 12, 2014, 11:20 PM EST
ok
you are _dopostback event.
this is also call from javascript if I am not wrong.
Sartaj2 reputationPosted Feb 13, 2014, 10:50 PM EST
Add in button ClientIDMode="Static" for Java Script firing
example :
Enjoy...
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 13, 2014, 11:01 PM EST
btn.attributes.add("OnClientClick", "javaScript: return ValidSave(););
ravi Gautam15 reputationPosted Oct 15, 2017, 12:01 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts