0

2

Hi,

I'm getting started using BugMonkey and I was wondering if there was a tutorial or documentation floating about.

From what I've seen, it seems to all use jQuery, and I'm functional in jQuery, though just enough to be dangerous.

I have two main questions.

  1. How do you work out what the name of standard control is? Is there a listing or do you just use Firebug and work out the name?

  2. If I want to add a change event to a form element, would I just do something like $(someSelector).changed = someFuncRef; in an onReady function?

More specifically, what I'd like to do is the following:

When someone is adding a new case to certain projects, I'd like my BugMonkey script to automatically add a certain tag. All the projects I'd like this tag to apply to start with "XYZ -". We use this tag to link related projects together. I can't say this is the best way to do it, but it's how it was implemented.

Thanks

Aaron

flag

1 Answer

3

Poking around with Firebug is probably your best bet for finding out the names/ids/classes of various elements on the page (there's definitely not a list anywhere).

As for your second question, the following BugMonkey script should get you started:

function bindProjectTagger(){
    //console.log('bindProjectTagger!');
    // bind to the change event for the Project dropdown
    $('#ixProject').change(function(){
        var sPrefix = "XYZ-";
        var sProject = $(this).find('option:selected').text();

        //console.log('project changed to: ' + sProject);

        if(sProject.substr(0, sPrefix.length) === sPrefix){
            // add our own tag
            $('#sTags').val('mySpecialTag');
            DropListControl.refreshWithin($('.tags'));
        }
    });
}

bindProjectTagger();

// wire up our project tagger after the ajax-transition to edit mode
$(window).bind("BugViewChange", function(ev, args) {
    //console.log('BugViewChange');
    bindProjectTagger();
});
link|flag
The first thing I want to do is automatically a tag when certain projects are selected in a new case. I'm new at this stackoverflow thing and it's ettiquette, so I'll edit the original message to add that in. Thank's for the firebug confirmation. It's what I expected. – Aaron Kaplan Mar 8 2011 at 18:43
I've updated my answer with a sample BugMonkey script that will add the 'mySpecialTag' tag to any case that is being created or edited when a project that starts with 'XYZ-' is selected. It doesn't handle removing the tag if a different project is selected though, but hopefully it's enough to get you started. – db Mar 9 2011 at 23:41
Thanks. I'll put that in now. I'm pretty OK once I get started. It's the getting started that I have a problem with. I have the same problem getting out of bed in the morning as well. Aaron – Aaron Kaplan Mar 10 2011 at 1:19

Your Answer

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