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

Question

Question

$(".action-btn").click(); running Save as Draft

asked on January 23, 2023 Show version history

Hey all,

 

Something weird happening here.  I've hidden my Submit button on my form because I am using my own custom button to execute the submit like this

    $(".action-btn").click();

I also have the Save as Draft enabled which displays that button.  However, when my custom button is clicked and my Javascript executes the command above it saves as draft and displays the corresponding dialog.  What's happening?  I thought Submit and Save as Draft were independent of each other.  

 

 

0 0

Answer

SELECTED ANSWER
replied on January 23, 2023 Show version history

The action-btn class is included on all of the four buttons, Submit, Approve, Reject, and Save.

See this screenshot from the Browser Inspect:

Your code isn't specific to any one of them individually, so it's not going to behave as you expect.

Try something like this instead:  

$(".action-btn.Submit").click();

That should find the specific element that has BOTH the action-btn class and the Submit class, and click it.

2 0
replied on January 23, 2023

Many thanks, that was it.  I guess I've never combined a custom submit button with an enabled "Save as Draft" before.  

1 0
replied on January 23, 2023

You are quite welcome.  You could have similar issues if you had any of the other buttons (Reject and Approve) enabled as well - so it's just best to be specific to which one you want to trigger.

0 0

Replies

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

Sign in to reply to this post.