0

We would like to have a date/timestamp automatically inserted whenever an entry is made in a custom long text field. Is this possible?

flag

1 Answer

1

That's not something that is possible out-of-the-box with FogBugz and the Custom Fields plugin.

Your best bet would probably be to create a custom plugin that provides that functionality.

As a workaround, you can use the following BugMonkey customization to add a button next to your long text field that will insert a timestamp when clicked:

name:          Long text timestamp keyboard shortcut
description:   Adds a button for inserting a timestamp into the "Log" text field
author:        Dane Bertram
version:       1.0.0.0

js:

var textfield = $('#logv11');
$('<input type="button" value="Append timestamp">')
.click(function(){
    textfield
    .val(textfield.val() + '\n' + new Date() + '\n')
    .focus();
})
.insertAfter(textfield);

Note: To use this, you'll need to find the id attribute for your long text field and replace logv11 in the code above with that value.

You can do this by inspecting your long text field with FireBug or a similar tool for your browser:

Inspecting text area with FireBug

link|flag
I tried the workaround suggested and nothing happens when I type CRTL+SHFT+D. Is there anything I might be missing? – ggib May 25 2011 at 16:58
js: $('#testxdetailp317').keydown(function(e){ // append current date and time when CTRL+SHIFT+D (char code 68) is pressed if(e.ctrlKey && e.shiftKey && e.keyCode === 68){ $(this).val($(this).val() + '\n' + "Hi Mom"); } }); – ggib May 25 2011 at 16:59
Hmm...that code works for me. What browser and browser version are you using? Note that the long text field will have to have the input focus when you press CTRL+SHIFT+D in order for it to work. – db May 25 2011 at 17:55
I started with Mozilla, but realized that CRTL+SHFT+D was being used by the browser, so I tried IE 7.0.5730.13. I do have the cursor in the text field when I type it. Any debugging suggestions? I'm stumped. Thanks – ggib May 25 2011 at 19:37
Hmm...keyboard shortcuts can be finicky sometimes depending on the browser (they all have different keyboard shortcuts), so I've updated my answer to insert a button instead. Let me know if that version works any better for you! – db May 26 2011 at 14:29
show 1 more comment

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.