If you need to detect if a Freedom UI page needs to be saved, you can do this easily using the page’s HasUnsavedData attribute. This attribute will be changed to true if the record needs to be saved. This attribute is also what provides the save button its visibility.
const needsSave = await request.$context.HasUnsavedData;
if (needsSave) {
// do somehting
}
Additionally, you can listen for changes to this attribute as well to respond to when it changes by wiring up the “crt.HandleViewModelAttributeChangeRequest” to have an event when the page needs saving:
{
request: "crt.HandleViewModelAttributeChangeRequest",
handler: async (request, next) => {
if (request.attributeName === "HasUnsavedData" && request.value) {
// the form needs saving, request.value will be true if needs saving
}
return next?.handle(request);
}
}
Additionally, the page does have another attribute as well, “IsChanged” that indicates if the page’s bound record has been changed.




Hello, you can also directly use “$HasUnsavedData” or “$HasUnsavedData | crt.InvertBooleanValue” as a value to control parameters such as “visible” or “disabled” which can come handy is some situations.
Yes you can. In fact, that is what the Save button on the page uses for it’s visible property.