Skip to main content

Update date field

Sets the current date to all date form fields in the document.

(function () {
let doc = Api.GetDocument();
let forms = doc.GetAllForms();

forms.forEach((form) => {
if (form.GetFormType() === "dateForm") {
form.SetFormat("dddd, dd MMMM yyyy");
form.SetLanguage("en-CA");

form.SetBackgroundColor(255, 0, 0); // Set background color to red.
}
});
})();

Methods used: GetDocument, GetAllForms, GetFormType, SetFormat, SetLanguage, SetBackgroundColor

Result

DateSetter DateSetter