showFieldMsg duplicates in my client script when I use hideFieldMsg and then show it again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2012 09:13 AM
I am tying to use showFieldMsg in my Service Catalog client script. I like the look of the g_form.showFieldMsg('field_name') however if I show it when the user makes an error ... then hide it using g_form.hideFieldMsg('field_name') when they make the correct entry ... then for what ever reason they make another error on that same field (they must be having a bad day) it will now show 2 error messages when I user g_form.showFieldMsg('field_name') to display the error to them again. I would like to use this instead of the javascript alert if I could stop the showFieldMsg messages from multiplying. Does anyone know if this is possible?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2012 09:29 AM
You can use the fieldMsg but you need to remember to hide it every single time before you invoke the 'show' function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2012 11:45 AM
I do hide it once I no longer need it however .... each time you go through that process of hiding and displaying the message duplicates.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2012 05:08 PM
It should work. Maybe if you post your script here I could see if there's something that could be fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2012 04:38 AM
This is the portion of the code that uses the showFieldMsg/hideFieldMsg, This is my last attempt. I initially used hideFieldMsg('TypeOfChange'). There is more to this code. The rest of the code has nothing to do with the field message so I didn't think you would be interested in seeing it. I put the ending } in just in case you wanted to try it. This is a service catalog item if that makes a difference. Thank you for your help on this.
function onChange(control, oldValue, newValue, isLoading) {
if (!isLoading) {
var comp = g_form.getValue('CompanyName');
var dep = g_form.getValue('Department');
var jt = g_form.getValue('JobTitle');
var t = g_form.getValue('TypeOfChange');
if (t != '') {
if (comp == '' || dep == '' || jt == '') {
g_form.setValue('TypeOfChange','');
g_form.showFieldMsg('TypeOfChange','Company, Department and Job Title are required prior to selecting response for Type of Change','error',false);
}
else {
// Display available applications
g_form.hideFieldMsg('clearAll');
}
}
}