Need a Jquery function to detect input loses focus
I am not sure that the name is unique - I cannot add an ID to it.
CustomSpace -- HardwareAsset.js -->
Then in the custom.js
// that works above
but I cannot get this to hit
Best Answer
-
Geoff_Ross Cireson Consultant O.G.Ok, timing issues... Try
app.custom.formTasks.add('HardwareAsset', null, function(formObj, viewModel) { $(document).ready(function () { /// This is the function that waits for page to load pageForm.viewModel.Target_HardwareAssetHasCatalogItem.bind("change", function (){ //console.log("changed"); var baseurl = location.origin var catId = pageForm.viewModel.Target_HardwareAssetHasCatalogItem.BaseId; $.ajax({ url: 'api call to get model' + catId, type: "GET", dataType: "json", contentType: 'application/json; charset=UTF-8', success: function (Cat) { pageForm.viewModel.set("Manufacturer",Cat[0].Man) pageForm.viewModel.set("Model",Cat[0].Mod) } }); }); }); });
1
Answers
I see what you are trying to do there, nice idea. I don't know about how to trigger on the lose of focus but you can bind to the change event. This is how I did it.
Geoff
});