Skip to content

Ignore Fields on Submission

In FormCreate, you can set global configuration and rule configuration to ignore specific fields when submitting forms, improving the flexibility and efficiency of form data processing. The following is a detailed explanation of how to use these configuration items.

Global Configuration: ignoreHiddenFields

ts
type IgnoreHiddenFields = Boolean;

When set to true, the form will automatically ignore all fields that are in a hidden state, meaning fields with hidden=true will not be included in the submitted data.

Usage Example

ts
const options = {
  ignoreHiddenFields: true
};

Rule Configuration: ignore

Each form field can be individually configured with an ignore property to determine the submission behavior of that field. The ignore property has two configuration options:

ts
type Ignore = Boolean | 'hidden';
  • true: Ignore the field on submission regardless of whether it is hidden or not.
  • 'hidden': Ignore the field only when it is hidden.

Usage Example

ts
const rule = {
  type: 'input',
  field: 'temporaryField',
  title: 'Temporary Field',
  hidden: true, // Can be changed dynamically
  ignore: 'hidden' // Will ignore based on the field's hidden state
}

Explanation: In this example, the temporaryField field will only be ignored when it is in a hidden state.

FormCreate is an open-source project released under the MIT License. Free for personal and commercial use.