0

The public new case screen selects the first area in the list. I would like the default selection to be the Undecided area.

I have tried the following:

$(document).ready(function() {
  if( window.location.href.indexOf("pg=pgPublicEdit") > 0 )
  {
    // sets text to '6'
    $("#idDropList_ixArea_oText").val('6');

    // sets text to 'Undecided' but does not select the item in the dropdown
    $("#idDropList_ixArea_oText").val('Undecided');

    // does not work at all
    $("#idDropList_ixArea_oText option:selected").removeattr('selected');
    $("#idDropList_ixArea_oText option[value='Undecided']").attr('selected', 'selected');
  }
});

I know the DLCL() function messes with the dropdown lists, but how do you manipulate them using BugMonkey?

flag

2 Answers

0

At Fog Creek, we just make _Undecided or _Default one of the area names and it filters to the top. Not pretty, but effective.

link|flag
I'm sorry, but that is week. You guys wrote all of this fancy javascript and don't have any way to set the default selection for a dropdown list? – John Biddle Nov 3 2010 at 16:02
0

I've finally figured out how to do this. I stole part of the idea from here: Question 4288

$(document).ready(function() {
  // preselect Project and Area dropdowns on the public case entry screen
  if(window.location.href.indexOf("pg=pgPublicEdit") > 0)
  {
    // Hide the Version and Computer custom fields
    $("#sidebar_custom1_-1").css('display', 'none');
    $("#sidebar_custom2_-1").css('display', 'none');

    // Pre-select the Inbox project (ixProject == 2)
    $("#ixProject option[value='2']").attr("selected", "selected");
    $("#ixProject").parents("div:first").find("input").val("Inbox");

    // Pre-select the Undecided area (ixArea == 6)    
    $("#ixArea option[value='6']").attr("selected", "selected");
    $("#ixArea").parents("div:first").find("input").val("Undecided");
  }
});
link|flag

Your Answer

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