Skip to Content
0

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

Jun 26, 2017 at 12:31 PM

122

avatar image

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!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Tamas Hoznek
Jun 27, 2017 at 03:42 AM
0

Does this help to get rid of the blank entry?

Share
10 |10000 characters needed characters left characters exceeded
Jeff Welsh Jun 27, 2017 at 12:11 PM
0

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!

Share
10 |10000 characters needed characters left characters exceeded
Alexandre Ourth 6 days ago
0

Hi Jeff,

Did you find a solution to this unwanted blank line?

Edit : Check "recommended" in advanced options

Regards,

Alexandre

Share
10 |10000 characters needed characters left characters exceeded
Jeff Welsh 17 hours ago
0

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

Share
10 |10000 characters needed characters left characters exceeded