You are viewing limited content. For full access, please sign in.

Question

Question

Can we run Javascript on click of submit button in laserfiche forms ?

asked on June 11, 2020 Show version history

Hi,

I want to run small javascript code on click of submit button. Is this possible ?

 

Thank you,

Sudesh.

0 0

Replies

replied on June 12, 2020

Yes, you can add an event listener to listen for a click on the submit button to run the JavaScript. See here for more information on event listeners:

https://www.w3schools.com/js/js_htmldom_eventlistener.asp

Keep in mind that there is more than one way to submit a form, for example if a user is navigating the form with their keyboard and they hit the Enter key on the button, the form will submit and your JavaScript won't run. So you'll need to account for other event listeners. jQuery has some short-hand syntax, like this:

$(document).ready(function() {
    $('.Sumbit').click(function() {
        alert('Submit button clicked!');
    });
})

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.