During form submit operation, how to stop redirect if validation failed

SundaramR
Tera Guru

Hi,

I have form and submit components in my page.  For the Submit button added the Form submit event and Redirect event handler  to different page.  Currently even if form validation fails, it re-direct to /events page. But I want to re-direct only if validation is successful and from is submitted successfully redirect to /events page, otherwise stay on the same page.  Looking some help to achieve this.

 

Thanks

1 ACCEPTED SOLUTION

SiddhardhaN
Tera Guru

For form controller, try setting condition in event handler - try setting up 

On, Form submit completed -> Link to destination Relay (Default) event handler with condition "status = success".



Screenshot 2025-02-18 at 5.26.24 PM.png

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @SundaramR 

 

You can use the client script on this, and add the error messages and on ok proceed further and in cancel back to same page.

 

https://servicenowguru.com/scripting/stopping-record-submission-servicenow/

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

SiddhardhaN
Tera Guru

For form controller, try setting condition in event handler - try setting up 

On, Form submit completed -> Link to destination Relay (Default) event handler with condition "status = success".



Screenshot 2025-02-18 at 5.26.24 PM.png