vicky Mohan
vicky Mohan

Reputation: 21

How to call multiple Javascript function using onclientclick

I have a asp button code is:

<asp:Button ID="Button1" runat="server" 
Text="Submit" onclick="btn_click"   

onclientclick= "javascript:returnisvalid
(document.getelementbyid
('*somevalue*'));" />

What I need is now I need to call another function to prevent double clicking of the button which I created is

Function disablesave(savebutton){
Savebutton.disabled=true;
Savebutton.value=true;

}

How can I validate the form and call this function on single onclientclick? Can anyone guide me on this?

Upvotes: 0

Views: 719

Answers (1)

Aristos
Aristos

Reputation: 66641

You can call multiple functions by separate them with semicolon ;, or comma ,

onclientclick="function1(); function2();"

You can also call them connected with logical operations if you need to validate all of them, for example:

onclientclick="return (function1() && function2());"

or even as

onclientclick="function1(); return function2();"

alternative to avoid double submissions and only with javascript used you can go to the form and add your logic there using the onsubmit

<form id="form1" runat="server" onsubmit="return disableForm(this);">

Then on the javascript function disableForm() add your logic procedures.

Upvotes: 1

Related Questions