Creating an Error Message in Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:18 PM
I'm a novice in JS so I'm having some difficulty making a client script to make an error message on the Demand form to tell the user they need to answer a question in a choice field before continuing if the "portfolio" field contains a value of "AIT." Any suggestions would be very appreciated! At this point I have not found a suitable script to tweak for my purpose, but I do know I probably need to use "getErrorMessage." Thanks!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:42 PM
Create a onLoad client script and your code will look like this
function onLoad() {
if(g_form.getValue('field name of portfolio')=='choice value of AIT' && g_form.getValue('field name of the checkbox')=='Yes'){
g_form.addErrorMessage('message goes here');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:50 PM
With this I'm not understanding the second part with the 'Yes',wouldn't this need to be put as not answered? (Not sure what I'd actually need to put there.)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:51 PM
Yes my bad it shoule be No. And is that a variable or field on the demand table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:55 PM
The choices for the question they need to answer are Yes and No, with --None-- being the default, should it be "None"? The question is a field on the demand table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2017 01:58 PM
if that is the case it should be this
function onLoad() {
if(g_form.getValue('field name of portfolio')=='choice value of AIT' && g_form.getValue('field name of the question')==''){
g_form.addErrorMessage('message goes here');
}
}