diff --git a/assets/js/src/form_editor/blocks/custom_text/custom_text.jsx b/assets/js/src/form_editor/blocks/custom_text/custom_text.jsx index b00c886fae..76aae6b737 100644 --- a/assets/js/src/form_editor/blocks/custom_text/custom_text.jsx +++ b/assets/js/src/form_editor/blocks/custom_text/custom_text.jsx @@ -22,6 +22,10 @@ export function getSettings(customField) { type: 'boolean', default: false, }, + validate: { + type: 'string', + default: '', + }, customFieldId: { type: 'string', default: customField.id, diff --git a/assets/js/src/form_editor/blocks/custom_text/edit.jsx b/assets/js/src/form_editor/blocks/custom_text/edit.jsx index 430b806242..d04e95f857 100644 --- a/assets/js/src/form_editor/blocks/custom_text/edit.jsx +++ b/assets/js/src/form_editor/blocks/custom_text/edit.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Panel, - PanelBody, + PanelBody, SelectControl, TextControl, ToggleControl, } from '@wordpress/components'; @@ -30,6 +30,28 @@ const FirstNameEdit = ({ attributes, setAttributes }) => { checked={attributes.mandatory} onChange={(mandatory) => (setAttributes({ mandatory }))} /> + (setAttributes({ validate }))} + /> diff --git a/views/form/editor.html b/views/form/editor.html index d4d50c095b..61d663162c 100644 --- a/views/form/editor.html +++ b/views/form/editor.html @@ -43,6 +43,11 @@ 'settingsPleaseSelectList': __('Please select a list'), 'fieldsBlocksCategory': __('Fields'), 'customFieldsBlocksCategory': __('Custom Fields'), + 'customFieldValidateFor': __('Validate for'), + 'customFieldValidateNothing': __('Nothing'), + 'customFieldValidateNumbersOnly': __('Numbers only'), + 'customFieldValidateAlphanumerical': __('Alphanumerical'), + 'customFieldValidatePhoneNumber': __('Phone number, (+,-,#,(,) and spaces allowed)'), 'blockMandatory': __('Mandatory field'), 'blockFirstName': __('First name'), 'blockFirstNameDescription': __('Input field used to catch subscribers’ first names.'),