Closed iangus closed 6 years ago
I added a js event to the callback function, and you can get more info from the event. Now your checkChanges function would look like:
function checkChanges(newValue, event){ // Get the field the key listener fired on. var field = elements[event.getElementName()]; var dataProviderID = field.getDataProviderID(); var currentValue = foundset.getDataProviderValue(dataProviderID); if(currentValue != newValue){ // Changes detected. }else { // No changes. } }
Currently the key listener returns the element value to the callback function, but there is no way to find what element the value is from.
By returning the element name, it allows the RuntimeComponent to be found in servoy using elements[elementName]. This then allows the returned key listener value to be checked against the current servoy value for any changes.
Requested change in keylistener.js line 28
$window.executeInlineScript(callback.formname, callback.script,[$element.val()]);
change to$window.executeInlineScript(callback.formname, callback.script,[$element.val(),$element[0].name]);
Example use: