CAD · Question #48
When writing a Client Script to provide feedback targeted at a specific field, which method should be used?
The correct answer is B. g_form.showFieldMsg(). This question asks for the correct g_form client-side method to display a message associated with a specific form field.
Question
When writing a Client Script to provide feedback targeted at a specific field, which method should be used?
Options
- Ag_form.showInfoMessage()
- Bg_form.showFieldMsg()
- Cg_form.addInfoMessage()
- Dg_form.addFieldMsg()
How the community answered
(30 responses)- A3% (1)
- B87% (26)
- C7% (2)
- D3% (1)
Why each option
This question asks for the correct `g_form` client-side method to display a message associated with a specific form field.
`g_form.showInfoMessage()` displays a general information message at the top of the form, not targeted to a specific field.
The `g_form.showFieldMsg()` method is used in client scripts to display a message directly below a specified form field, making the feedback context-specific.
`g_form.addInfoMessage()` is an older or less common method that also displays a general message at the top of the form, without field specificity.
`g_form.addFieldMsg()` is an older or less common method for displaying a field-specific message; `showFieldMsg()` is the preferred and more commonly used method for this purpose.
Concept tested: Client script field-specific messages
Source: https://docs.servicenow.com/bundle/utah-application-development/page/script/client-scripts/reference/r_ClientScriptAPI.html
Topics
Community Discussion
No community discussion yet for this question.