CSA · Question #273
A customer wants to use a client script to validate things on a form in order to make sure the submission makes sense. What type of client script would you recommend to meet this requirement?
The correct answer is A. onSubmit(). To validate form data and prevent submission if criteria are not met, an onSubmit() client script is used.
Question
A customer wants to use a client script to validate things on a form in order to make sure the submission makes sense. What type of client script would you recommend to meet this requirement?
Options
- AonSubmit()
- BonSubmission()
- ConUpdate()
- DonLoad()
How the community answered
(54 responses)- A87% (47)
- B4% (2)
- C7% (4)
- D2% (1)
Why each option
To validate form data and prevent submission if criteria are not met, an onSubmit() client script is used.
An onSubmit() client script executes just before a form is submitted, allowing for validation logic to run and, if conditions are not met, to abort the submission, ensuring data integrity.
onSubmission() is not a standard or recognized type of client script in ServiceNow for form validation.
onUpdate() is not a client script type in ServiceNow; server-side Business Rules typically handle updates after submission.
onLoad() client scripts execute when a form loads, which is too early for validating data just before submission.
Concept tested: Client script types for form validation
Source: https://docs.servicenow.com/bundle/utah-application-development/page/script/client-scripts/concept/client-script-types.html
Topics
Community Discussion
No community discussion yet for this question.