I'm calling this function from .cs file what is wrong
function Confirmcertificate(){
var agree=confirm("Not sending any certificate");
if(agree)
return true;
onsubmit: true;
else
return false;
onsubmit: false;
}
.cs file coding is
ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(),
"load","Confirmcertificate();", true);
dumbass
27.2k4 gold badges43 silver badges77 bronze badges
asked Dec 22, 2011 at 5:55
Phanindra Kumar
1693 silver badges16 bronze badges
3 Answers 3
Remove the line after returning true and false
onsubmit: true;
onsubmit: false;
answered Dec 22, 2011 at 6:00
Adeel
19.3k4 gold badges48 silver badges60 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Remove the lines:
onsubmit: true;
and
onsubmit: false;
That's not valid Javascript.
answered Dec 22, 2011 at 6:00
Abdullah Jibaly
55.2k45 gold badges130 silver badges202 bronze badges
Comments
Several problems:
function Confirmcertificate(){
if(confirm("Not sending any certificate"))
{ // you need braces to encapsulate multiple statements
onsubmit = true; // I imagine you meant to assign to some global variable...
return true; // This must come after the assignment
} else {
onsubmit = false; // this must come before return
return false;
}
}
With those changes it should work.
answered Dec 22, 2011 at 6:04
canon
41.8k10 gold badges77 silver badges102 bronze badges
Comments
lang-js
ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(),"load","alert('Hello world';", true);