Changes between Version 3 and Version 4 of Ticket #13298
- Timestamp:
- May 21, 2020, 6:28:28 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13298 – Description
v3 v4 7 7 The problem is due to two changes: 8 8 * In r13452 the workflow controls were added to the new ticket page. We added the //create and assign// action, which includes a select box for assigning the owner. 9 * In r13707 the `ticket_workflow ` template was added and the associated !JavaScript was moved into this template. !TheJavaScript disables workflow inputs associated with actions that are not selected, such as the //create and assign// assign-to field. Since jQuery ready handlers executed in the order they are added, this JavaScript executes after autoSubmit initializes.9 * In r13707 the `ticket_workflow.html` template was added and the associated !JavaScript was moved into this template. The !JavaScript disables workflow inputs associated with actions that are not selected, such as the //create and assign// assign-to field. Since jQuery ready handlers executed in the order they are added, this JavaScript executes after autoSubmit initializes. 10 10 11 11 With the default workflow, `create` action will be selected when loading the New Ticket page. … … 21 21 [[Image("Screen Shot 2020-05-16 at 15.06.43.jpg")]] 22 22 23 I tried to solve this in several ways by executing the JavaScript in `ticket_workflow.html` immediately after the elements are created rather than adding a document ready handler. This results in a flicker in which the element is shown for milliseconds without being disabled. So I tried hiding the entire form element until the JavaScript is executed. It's a bit messy.23 I tried to solve this in several ways. First, by executing the JavaScript in `ticket_workflow.html` immediately after the elements are created rather than adding a document ready handler. This results in a flicker in which the element is shown for milliseconds without being disabled. Then, I tried hiding the entire form element until the JavaScript is executed, but it makes for complex code. 24 24 25 Or we could move the `script` block in `ticket.html` to the end of the page.25 Another option would be to move the `script` block in `ticket.html` to the end of the page, so that the document ready handler is positioned after the one in `ticket_workflow.html`. 26 26 27 It looks like we can just initialize `values` on the first trigger, because we trigger on element losing focus (`blur`) as well as keydown, and `values` gets initialized before any elements of the form are changed.27 There appears to be a simpler solution. It looks like we can just initialize `values` on the first trigger, because we trigger on element losing focus (`blur`) as well as keydown, and `values` gets initialized before any elements of the form are changed. 28 28 {{{#!diff 29 29 diff --git a/trac/htdocs/js/auto_preview.js b/trac/htdocs/js/auto_preview.js