Javascript Error

Moderator: crythias

Post Reply
Phoenix78
OTRS newbie
Posts: 5
Joined: 07 Nov 2017, 00:50
OTRS Version?: 6.0.4

Javascript Error

Post by Phoenix78 » 16 Aug 2018, 12:04

Hi,

I got a problem on my OTRS system (otrs-6.0.4-03).
I activated the time-accounted mandatory option, but my users have a JavaScript error when they add a duration...

"An error occured! Please check the browser error log for more details!"

The error :
[ERROR] JavaScriptError: Syntax error, unrecognized expression: label[for=]
in Core.Debug.js:61:13



Someone got an idea how to fix this?

jojo
Moderator
Posts: 14343
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: Javascript Error

Post by jojo » 16 Aug 2018, 12:09

- any packages installed?
- which browser?
- did you clear all caches (OTRS and Browser)
- also you should upgrade to the latest version due to security and other bugfixes
"Production": OTRS™ 6, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

Phoenix78
OTRS newbie
Posts: 5
Joined: 07 Nov 2017, 00:50
OTRS Version?: 6.0.4

Re: Javascript Error

Post by Phoenix78 » 16 Aug 2018, 12:31

Thanks for reply.
I found the problem : I modified a line in /opt/otrs/Kernel/Output/HTML/Templates/Standard/AgentTicketActionCommon.tt ...
I need to set minute as time unit, but sometimes accounted time for a note is like 1 month... So I added a dropdown list...

on line 417, I replace
<input type="text" name="TimeUnits" id="TimeUnits" value="[% Data.TimeUnits | html %]" class="W50pc Validate_TimeUnits [% Data.TimeUnitsRequired | html %] [% Data.TimeUnitsInvalid | html %]"/>
with
<input list="TimeUnits" class="W50pc Validate_TimeUnits [% Data.TimeUnitsRequired | html %] [% Data.TimeUnitsInvalid | html %]"/>
<datalist id="TimeUnits">
<option value="60">1 hour</option>
<option value="120">2 hours</option>
...
</datalist>
This can't work?

zzz
OTRS superhero
Posts: 215
Joined: 15 Dec 2016, 15:13
OTRS Version?: 3.x - 6.0.x
Real Name: Emin
Company: maxence business consulting GmbH
Contact:

Re: Javascript Error

Post by zzz » 20 Aug 2018, 09:52

Hello,

no, that can't work, as you have noticed already.
You have changed the type of a static field which has a different way of checking values.
You could make the default field invisible, create your custom dropdown, and update its value with an EventListener that listens on changes of your list (basic JavaScript skills needed).

Best regards
Emin

Post Reply