You are viewing a Laserfiche Cloud help topic. If you're not using Laserfiche Cloud, see the Laserfiche User Guide or Laserfiche Administration Guide.

The LFForm Object

The LFForm object provides a global interface for accessing Laserfiche form elements and events using JavaScript. Through simple functions, you can find a specific field, retrieve the field values, and update field contents. You also have access to events both at the individual field level as well as the form submission event.

LFForm Interfaces


Finds fields that satisfy an arbitrary set of conditions. Any field attribute may be used to perform the search.



Retrieves the value or values of the specified field.


  1. For a single line field with field ID: 10, and with a current value of "Hello", LFForm.getFieldValues({fieldId: 10}) returns "Hello".
  2. For a repeatable field with 3 rows, where each row has a single line with fieldID: 10and row values are: row 1, value "a"; row 2, value "b"; and row 3, value "c":
    • LFForm.getFieldValues({fieldId: 10}) will return ["a", "b", "c"].
    • LFForm.getFieldValues({fieldId: 10, index: 0) will return "a".
  3. To print out the value of a field on the console:
    • console.log(LFForm.getFieldValues({fieldId: 4}))


Sets a field value for a specified field element.

setFieldValue Examples

The following examples illustrate setting field values :

Additional examples:


Used to subscribe to events.


Use to unsubscribe from events.


Used to subscribe to the change event for specific fields.



Used to subscribe to the blur event for specific fields



LFForm.onFieldBlur(function () { LFForm.setFieldValues({fieldId: 3}, LFForm.getFieldValues({fieldId: 2}));}, {fieldId: 2});


Used to subscribe to the formSubmission event.

Note: if the handler returns an object with "error" property (e.g {error: "There is something wrong on the form. Cannot submit."}), the submission is stopped and the error will be displayed as a toast on the page.


LFForm.onFormSubmission(function () { if (LFForm.getFieldValues({fieldId: 2}) === "no")

return {error: "There is an error. Do something before submitting again."}})