Form Preferences

Scripting Custom Scripts

The Preference Form system allows you to attach a secondary form to forms from the Form Editor. It will allow only one submission per user, and can be loaded and accessed programmatically from a Form object. Using it, you can allow users to set custom preferences for a form, or save structured user data accessible from any submission to the form. The preferences submission for the current user can be accessed with

submission.form.preferences

The form.preferences object is very similar to the form.submissions object, except it only deals with a single submission.

load()

Loads the preference submission in the background, without displaying its modal to the user. This method returns a jQuery Deferred object. The deferred object resolves with a Submission object for the preferences.

submission.form.preferences.load().done(function(preference_submission) {
  preference_submission.modal.show()
})

loaded()

Returns a boolean indicating whether the preferences submission has been loaded for the current page.

submission.form.preferences.loaded()

open()

Opens the preference form modal for the user, loading it from the server if not already loaded. This method returns a jQuery Deferred object. The deferred object resolves with a Submission object for the preferences.

submission.form.preferences.load().done(function(preference_submission) {
  preference_submission.fields.first()
})

submission

Returns a Submission object for the user's preferences.

submission.form.preferences.submission.fields.field_name.value()