If you have the listbox dataprovider property set to a form or global variable, there is no need to have a onDataChange event to store the new value; the listbox control is "bound" to the variable. You just want to be sure that the return value of the valuelist that is associated with the listbox is the pk of the customer that is selected. The pk is all you would need to reference any field in that particular customer record. If you want some event to happen when you select a different customer, you can, as suggested already, use the onDataChange method that is attached to the listbox. The autogenerated servoy code will look like this:
- Code: Select all
/**
* Handle changed data.
*
* @param {String} oldValue old value
* @param {String} newValue new value
* @param {JSEvent} event the event that triggered the action
*
* @returns {Boolean}
*
* @properties={typeid:24,uuid:"FE8D2254-97BA-4010-B21A-E85EBCA7A437"}
*/
function onDataChange(oldValue, newValue, event) {
// TODO Auto-generated method stub
return true
}
Servoy already will provide you with the paramaters shown above
oldValue, newValue, event. You just need to figure what you want to do next.