Page 3 of 3

Populate Select with Contact Service on Screen Load

Posted: Thu Apr 24, 2014 6:15 am
by Illya Stepanov

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.


Populate Select with Contact Service on Screen Load

Posted: Thu Apr 24, 2014 4:01 pm
by Milton Davis

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


Populate Select with Contact Service on Screen Load

Posted: Thu Apr 24, 2014 9:44 pm
by Alena Prykhodko

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