Define a Button in status page calling a function without su

Posted by Jorrit on 13-Jan-2016 01:51

Hi,

Could anybody help me?

We have a object with workflow actions/status and status pages.

What i want is to create a custom button that execute my function without submitting the form.

i found an example to create a button i.e.

<button onclick="myFunction()">Click me</button>
<script>
function myFunction(){
alert("Welcome");
}
</script> 

in the above example the function is executed. But after that the form is submitted.

Is there any way to prevent the form submitting when there is a custom button on a Status page?

Thanks in advance

Jorrit

All Replies

Posted by murali on 13-Jan-2016 11:16

function myFunction(){
             alert("Welcome");
             return false;
}

Does this work?

Posted by Jorrit on 14-Jan-2016 02:12

Hi Murali,

no still after the message the form is submitting.

regards Jorrit

Posted by Mohammed Siraj on 14-Jan-2016 02:23

Hi Jorrit,

The onlick handler should return false for the event not to propagate & prevent default action. Can you please try out the below snippet,

<button onclick="return myFunction();">Click me</button>

<script>

function myFunction(){

alert("Welcome");

return false;

}

</script>

Posted by Jorrit on 14-Jan-2016 02:34

Hi Murali,

Managed to get it work with kendo:

<button id="button" type="button">Click me</button>

<script>

$("#button").kendoButton();

var button = $("#button").data("kendoButton");

button.bind("click", function() {

   function();

});

</script>

thanks for the help.

regards Jorrit

This thread is closed