Warning on additional comments

priisholm
Mega Expert

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:

warning.png

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:

comments.png

And when I remove the text from the "comments"-field it will look normal..:

comment2.png

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....)

screenmove.png

Thanks!

Soren

7 REPLIES 7

Hi Mike



I'n not quite sure what you want me to do



I just want to warn when someone writes in the "comments" field.



It could be with a red box around it, but I think the (red) text is better or even an pop-up. My main problem here is that SN jumps to the start of the form every time I run the "onChange" clientscript.



Isn't there at way to keep SN focused on the field that you are actually writing in..?



BR


Soren


Right.   My intention was to give you options to try.   If you remove the contextual search when not needed (like, in open tickets), that frees up space on the form.   And then it doesn't matter where the form jumps to.



Highlighting the field in red just brings extra attention to it.



Instead of using alert, you can use confirm in an onSubmit script, saying when a user submits a ticket, a confirm window pops up that says 'Hey, your notes go directly to the customer, are you sure you want to proceed?'



You could also add the addInfoMessage instead of the add field message, which adds the warning to the top of the form.



What I am really trying to do is say, I don't know how to stay focused on the field, and if you don't get an answer, here are other options to accomplish the same thing.


Community Alums
Not applicable

Hello,

 

If this is still a problem, there is the fourth parameter for showFieldMsg method that allows you to disable scrolling, so you need to do something like:

g_form.showFieldMsg('comments','REMEMBER, that all you write here will go directly to the enduser! ','error', false);

 

Cheers,

Lukasz Pilch