Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12957 closed defect (fixed)

[PATCH]: javascript TypeError when changing ticket type

Reported by: Cinc-th Owned by: tkob-trac
Priority: normal Component: TicketStencilPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

The javascript error TypeError is triggered when changing ticket types while the description field is not empty and no template is defined.

Configuration

The following ticket types are defined:

  • defect
  • task
  • foo
  • ...

Only for type foo a template is defined.

Browser: Firefox 50.0

How to trigger the problem:

  1. Create a new ticket, it defaults to defect
  2. Enter something into the description field
  3. Change the ticket type from defect to task

On the javascript console of your browser the following error is shown

TypeError: _tracticketstencil[prev_type] is undefined ticketstencil.js:8:1

and subsequent jacascript code is not executed.

Patch

  1. The patch makes sure that for every ticket type a default description is defined in the array _tracticketstencil[] thus _tracticketstencil[prev_type].trim().replace(/\r\n/g, "\n") can be calculated.
  1. In addition it ensures the data attribute is always set.
  1. It defines a default for prev_type in case the data attribute is lost. This one is probably superfluous because of the former changes but it doesn't hurt.

Attachments (1)

typeerror.patch (2.7 KB) - added by Cinc-th 8 years ago.
Fix for TypeError during javascript execution when changing ticket types.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Cinc-th

Attachment: typeerror.patch added

Fix for TypeError during javascript execution when changing ticket types.

comment:1 Changed 8 years ago by tkob-trac

Resolution: fixed
Status: newclosed

In 15982:

Apply a patch from Cinc-th to avoid TypeError in JS, closes #12957

comment:2 Changed 8 years ago by anonymous

Thank you!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain tkob-trac.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.