Warning on additional comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 04:39 AM
Hi 🙂
I want to warn itil-users every time they attempt to write in the "Additional Comments" field/box (on the incident-form) - that any comment here will go directly to the enduser (or portal).
I made an onChange:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if (oldValue == newValue)
return;
g_form.hideFieldMsg('comments', true);
g_form.getControl('comments').focus();
if (g_form.getValue('comments') != '') {
g_form.showFieldMsg('comments','REMEMBER, that all you write here will go directly to the enduser! ','error');
}
}
----
It will look like this when I start writing in the "comments"-field:
And when I remove the text from the "comments"-field it will look normal..:
But! My problem is that the "Additional Comments" field doesn't stay focused on the screen or the form move down, so I no longer can see the "additional comments" field... This is a problem when the "related search result" is opened... But it will also be a problem when there are too many field in the top of the form...
It seem that the form always show from the "top"..
It there a way to avoid this? (in the script or....)
Thanks!
Soren

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 04:59 AM
Hey Soren,
You can use alert() as well for warning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 06:04 AM
Hi Nayan
In my case an Alert() will in show a pop-up everytime I add one letter to the "additional comments".
BR
Søren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 05:53 AM
Some ideas:
One, you can make that field always visible with a global user preference.
You can make the border red:
g_tabs2Sections.setActive(0); // should be the notes tab, but you can find which number is assigned in the form section table
document.getElementById('problem.comments').style.border = "solid 1px red";
But, do it without DOM manipulation, probably jQuery.
What this does for us is shift over to the tab in question and highlight the field in red.
You can hide the search context if the form is not new by setting it up like so:
CI is a mandatory field for all incidents. If it is empty, the record is new.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2017 05:56 AM
And I would ALWAYS do this:
AlertNow - Share - JavaScript Alert Replacement
It replaces the hideous javascript browser alert with something with more style. You can find it on Share: