Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Populate Select with Contact Service on Screen Load

Hi Milton,

Sorry first time needed to check this.

Please try this solution:
ol
liAdd you select one more item with "default" value and "default" key. http://prntscr.com/3cvot2/direct/li

liComment code:
precode
Appery("Select_Friends").prepend("default");
Appery("Select_Friends").selectmenu("refresh", true);
$(".ui-selectmenu-list li").removeClass("ui-screen-hidden");
$(".ui-selectmenu-list li").removeClass("ui-first-child");
$(".ui-selectmenu-list li:nth-child(1)").addClass("ui-first-child");/code/pre/li

liChange your code in friends_success event handler with:
precode

//Filter values returned from Contact Service ----------------------
Appery("Select_Friends").find("option").each(function(){
var $this = $(this);
//Remove values that contain a # or are blank
var itemText = $this.text().trim();
if (itemText.indexOf("#") > -1 || itemText.length === 0) {
$this.remove();
}

});

//Appery('Select_Friends').val('default').selectmenu('refresh');

Appery("Select_Friends").val("default");
Appery("Select_Friends").selectmenu('refresh', true);

//Add Default to Friends selector---------------------------------------------
/code/pre/li
/ol
Regards.

Milton Davis
Posts: 0
Joined: Tue Mar 04, 2014 5:12 am

Populate Select with Contact Service on Screen Load

Illya,

Adding the second default made it show up on screen load now. The only problem I am having now is that it still is automatically selected when I click the select menu. How do I make it not be checked? Image Image

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Populate Select with Contact Service on Screen Load

Hello Milton,

Unfortunatly not, if you want to see the legend in select default (or any other) you will need to set it checked.

You can delete "default" value when use this value.

For example click "Add JS" in server mapping and place following code:
pre

var val = Appery("Select_Friends").val();
return val.replace(/default$/gi, "");/pre

Return to “Issues”