Skip to content

Commit

Permalink
✨ [open-formulieren/open-forms#4542] Added the optional requireVerifi…
Browse files Browse the repository at this point in the history
…cation email extension

The extension is added under the openForms namespace to prevent
possible future collissions, and to make it explicit this is an
additional feature added by Open Forms.

The property is optional so that existing email components do not
require a data migration - not specifying it is falsy, which is the
default behaviour.

The property is not added under the 'validate' namespace, because it's
something that can only be properly validated server-side - it does not
make sense to configure client-side validation error messages for this
validation step because of that reason. We can still emit validation
errors server-side in a way that they will probably be displayed with
the component as if it was client-side validation.
  • Loading branch information
sergei-maertens committed Aug 19, 2024
1 parent 5d1fd23 commit 58edc62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/formio/components/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import {InputComponentSchema, MultipleCapable} from '..';
type Validator = 'required';
type TranslatableKeys = 'label' | 'description' | 'tooltip';

export type EmailInputSchema = InputComponentSchema<string, Validator, TranslatableKeys>;
export interface EmailExtensions {
requireVerification?: boolean;
}

export type EmailInputSchema = InputComponentSchema<
string,
Validator,
TranslatableKeys,
EmailExtensions
>;

/**
* @group Form.io components
Expand Down
1 change: 1 addition & 0 deletions test-d/formio/components/email.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ expectAssignable<EmailComponentSchema>({
translations: {
nl: {label: 'foo'},
},
requireVerification: true,
},
// fixed but not editable
validateOn: 'blur',
Expand Down

0 comments on commit 58edc62

Please sign in to comment.