Welcome to my old Blogspot blog!
You can read this post on our new website: Read this post on our new website
Following is sample JavaScript code to demonstrate the auto completion feature. This sample configures the auto-complete feature for a custom single line of text that auto complete years.
Call following function on form load event, this will auto populate the last 60 years in the field when do keypress on this field.
Call following function on form load event, this will auto populate the last 60 years in the field when do keypress on this field.
function year_AutoComplete() {
var keyPressFcn = function (ext) {
try {
resultSet = {
results: new Array()
};
var dt = new Date();
for (i = 0; i < 50; i++) {
resultSet.results.push({
id: i,
fields: [dt.getFullYear() - i]
});
}
if (resultSet.results.length > 0) {
ext.getEventSource().showAutoComplete(resultSet);
} else {
ext.getEventSource().hideAutoComplete();
}
} catch (e) {
console.log(e);
}
};
Xrm.Page.getControl("new_year").addOnKeyPress(keyPressFcn);
}
No comments:
Post a Comment