I have recently discovered that when I update any date in Lightswitch HTML, whether it be in C# or JavaScript, that it causes the application to display this message:
if i comment out anything that changes the date then this does not appear.. so my question is has anyone else come across this problem and if so, what is the fix?
some examples of code that causes the error:
JS - Executed on a custom Save button
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate() + 0);
if (screen.OrderRequest.changedate == null) {
screen.OrderRequest.changedate = tomorrow;
}
C# executed on either the inserting or updating method
partial void OrderRequests_Updating(OrderRequest entity) {
entity.changedate = DateTime.Now;
}
JS - executed in the beforeApplyChanges also causes same error:
myapp.OrderScreenView.beforeApplyChanges = function (screen) {
screen.OrderRequest.changedate = Date.now();
};
It is possible that your custom save button is causing the problem. Any chance you could implement the beforeApplyChanges event and handle any updates there?