Skip to Content

Personas - Any way to remove blank entry in Drop-Down List?

Hi,

We're running Personas 3.0 SP4, and the question pretty much says it all. I'd like to be able to remove the blank entry in the Drop-Down List. I can see where it might have it's uses, but if a selection is required, having a blank choice just creates extra work as it has to be coded for, including an error message for the user if they select it.

Thanks for your help!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Jun 27, 2017 at 03:42 AM

    Does this help to get rid of the blank entry?

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 27, 2017 at 12:11 PM

    Hi Tamas,

    That was great information. Unfortunately, it does not resolve my specific blank line at the end of a DropDownList issue. Apparently Personas does not count the blank line as part of the Entries collection. For example, I tried the following code:

    var objDropDown = <Drop Down GUID>;
    var objEntries = objDropDown.entries;
    objEntries.removeAt(objEntries.length - 1);
    objDropDown.entries = objEntries;
    

    Instead of removing the blank line at the bottom of the list, it removes the line just above the blank line. I also tried specifying the row with the blank line specifically (objEntries.removeAt(3);), but that did not work either.

    Any other thoughts?

    On a kind of related issue, is there anyway to select the value shown in a DropDownList? For example, the first entry in my list has a text value of ----- Options -----, with a number of screen related options in the following entries. When the user selects an option, the drop down list continues to show the selected entry. What I'd like to do is return the displayed entry back to ----- Options ----- after the user's option is executed. Is there any way to programmatically set which entry is displayed?

    Thank you very much for your help!

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20 at 09:13 AM

    Hi Jeff,

    Did you find a solution to this unwanted blank line?

    Edit : Check "recommended" in advanced options

    Regards,

    Alexandre

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 25 at 04:38 PM

    Hi Alexandre,

    No, I was not able to find a way to remove the blank line.

    The best I came up with was a workaround using JavaScript. I created an optionSelected script that is attached to the drop-down list's onSelect event. It uses a switch statement and the default catches a user selecting the blank line. So in that case, the script does nothing.

    // Determine which option the user selected.
    
    switch(newKey) {
     case "Option 1":
      session.findById("wnd[0]").sendVKey(1);
      break;
     case "Option 2":
      session.findById("wnd[0]").sendVKey(2);
      break;		
     default:
      break;		
    }
    

    I also created a resetDropdown script and attached that to the AfterRefresh event. In the drop-down list I created, the text in the first row is '---------- Options ----------', with a value of 'NONE'. This is just to let the user know there are options there for them to use. When the user selects an option, the script shown above executes the appropriate action, then the script shown below 'resets' the drop-down so that it again shows the Options choice.

    // Reset the dropdown list to the default value. NOTE: This must occur in the AfterRefresh event!
    if (session.findById("wnd[0]/usr/cmbPersonas_111111111111111").key != "NONE") {
      session.findById("wnd[0]/usr/cmbPersonas_111111111111111").key = "NONE";
    }
    

    With this code in place, if a user opens the drop-down list and clicks on the blank line, the first JavaScript routine simply exits since it falls into the default section of the switch. Then the second block of script runs during the AfterRefresh event and resets the drop-down list text back to the top Option line.

    The end result, for the user, is that clicking the blank line does not appear to do anything. Maybe not perfect, but the best I was able to come up with.

    I hope this helps.

    Jeff

    Add comment
    10|10000 characters needed characters exceeded