I have the following customflipbox created using the Datebox jQM plugin:
<div data-role="fieldcontain">
<label for="cf" data-i18n="config.localelabel"></label>
<input name="cf" type="date" data-role="datebox" id="cf" data-options='{"mode": "customflip",
"customData": [ {
"input": true,
"name": "",
"data": ["Italiano","English","Espanol","Deutsch","Francais","русский"]
}],
"useNewStyle": false,
"overrideStyleClass": "ui-icon-dice",
"useButton":false,
"useFocus" : true
}' />
When I pick a value I need to populate the cf input field with the selected value, I tried:
$('cf').on('datebox',function(p,e){
if (p.method === 'set') {
e.stopImmediatePropagation();
$(this).val(selectdata[p.value]);
}
});
on the 'datebox' event, but it seems the most i can get is that the field is populated with the index of the selected value but I need the actual string (e.g. English).
Any insight?
Thank you. M.
Add the data array in code and then you can reference it in 'set' event:
In code create a global variable called selectdata that is the array of values: