Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Firing Two Scripts One After Another

Avatar

Level 1

I have a submit button to submit PDF to email and a script to lock fields. But I need it to validate fields first then run the Lock Fields script before submitting it to email.

The problem I'm having is I can't get it to fire in that order. It will validate then it will submit email and not lock fields or it will lock fields and not validate fields. I have place the Lock Field script in the pre, post, mouseup, mousedown, etc. I'm at a lost with this one.    

Any ideas on whats wrong would be of great help.

1 Reply

Avatar

Level 10

Check this example for using two buttons to accomplish what you're after. Basically, your validate/lock script goes on a visible "submit" button and then fires the click event of a second button that does the actual submission.

http://www.assuredynamics.com/index.php/portfolio/check-if-form-is-signed-before-emailing/