Errors

Scripting Custom Scripts

The Error Management object handles errors for a single field, and is accessed with the errors key in a Field Object. In this documentation submission.fields.first() will be used to refer to a generic field, but other lookup methods can be used interchangeably.

add(text)

This method is available to server-side scripts.

Adds a user-visible error to the field's element. The text parameter should be a human-readable sentence, rather than an internal error code.

submission.fields.first().errors.add("There's a problem here!")

all()

This method is available to server-side scripts.

Returns an array containing all current error strings for this field.

submission.fields.first.errors.all()

any()

This method is available to server-side scripts.

Returns a boolean value indicating whether any errors are present for this field.

submission.fields.first.errors.any()

empty()

This method is available to server-side scripts.

Removes all errors from this field.

submission.fields.first.errors.empty()