Make field mandatory in ViewTicket80 screen

Hi,

I added a field to a request (ticket.x_product), and added this field to the ViewTicket80 screen by modifying the Edit entity menu.

I also made that field mandatory using the "cannot be empty"  option.

But this only works when editing the request through "Edit Request" in the action menu, and not when quick-editing directly in the ViewTicket80 form.

Is there a way to make that field mandatory?

regards,

Niels

RE: Make field mandatory in ViewTicket80 screen

Niels, as far as I know, it is not possible as you don't actually do any post action in the screen (besides changing Status, Category, and Owner).

Besides, it seems like a terrible user experience to have a field being mandatory when you enter the view ticket screen. 

Av: Simen Mostuen Iversen 22. feb 2018

RE: Make field mandatory in ViewTicket80 screen

Hi Simen,

Is it possible to  give a message, based on the trigger "status changed"?

Something like "Product is empty!"

Niels

Av: Niels van Broekhoven 22. feb 2018

RE: Make field mandatory in ViewTicket80 screen

You can probably do that by adding an HTML parser element and add a JavaScript that listens to the element and outputs something when changed, or if empty.

Av: Simen Mostuen Iversen 23. feb 2018

RE: Make field mandatory in ViewTicket80 screen

Hi Niels,

I'm not sure if you can use the triggers like that (but I haven't tried).

If you wanna get your hands dirty you can do it with a hook script. This is more of a hackaround though.

If you create a script with the following include name: "HtmlPage.ej_viewTicket_80.beforePrint", you can add the following to the script:

print("<script>");
print("$(document).ready(function() {if($('#EditEntityMenu_X_YOUR_FIELDNAME_label').val() == '') {  $('#EditEntityMenu_X_YOUR_FIELDNAME_label').parent().css('background-color','red'); }});");
print("</script>");

This should color the field red if it hasn't been filled in/is empty. You could always do other stuff like call an alert as well, but this might be too intrusive.

Av: Hans Wilhelmsen 23. feb 2018

RE: Make field mandatory in ViewTicket80 screen

Just a note: No need to add a hook script, just add a HTML parser element somewhere in the screen and add the javascript Hans mentioned.

Av: Simen Mostuen Iversen 23. feb 2018

RE: Make field mandatory in ViewTicket80 screen

Yeah, sorry - you need to use a hook script if you want to trigger it in a part of Service that has no editable screen.

Av: Hans Wilhelmsen 23. feb 2018