ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Exclude Fieldtype from Form Submission

Open aerni opened this issue 4 years ago • 1 comments

It would be great if we could configure custom fieldtypes to be excluded from form submissions. This is useful for fields that are solely used for displaying purposes on the frontend.

Example I created a capchta fieldtype for forms. In the fieldtype I set the following properties to only make the fieldtype selectable in the form blueprint builder:

protected $selectable = false;
protected $selectableInForms = true;

The fieldtype doesn't save any data to the form submission and should therefore be excluded from the submission listing, submission view, and export.

This could be implemented with an additional property like:

protected $visibleInFormSubmission = false

Exclude from listing:

Bildschirmfoto 2021-08-03 um 10 14 00 AM

Exclude from submission:

Bildschirmfoto 2021-08-03 um 10 13 08 AM

aerni avatar Aug 03 '21 08:08 aerni

I would also love to have an option to change redirect url via FormSubmitted event listener.

Krzemo avatar Oct 16 '21 21:10 Krzemo

I'm assuming you still need the field on the blueprint for it to be rendered on the frontend?

If so, you can prevent it being shown in listings/publish forms by adding the following to your field config:

listable: false
visibility: hidden

You can force these settings in the fieldtype's configFieldItems method:

protected function configFieldItems(): array
{
    return [
         'listable' => [
             'type' => 'hidden',
             'default' => false,
         ],
         'visibility' => [
             'type' => 'hidden',
             'default' => false,
         ],
    ];
}

duncanmcclean avatar Aug 19 '25 11:08 duncanmcclean