Add validation
[MAILPOET-2453]
This commit is contained in:
committed by
Rostislav Wolný
parent
eeaec19a6b
commit
f5d882b5e5
@@ -22,6 +22,10 @@ export function getSettings(customField) {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
validate: {
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
customFieldId: {
|
||||
type: 'string',
|
||||
default: customField.id,
|
||||
|
@@ -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 }))}
|
||||
/>
|
||||
<SelectControl
|
||||
label={`${MailPoet.I18n.t('customFieldValidateFor')}:`}
|
||||
options={[
|
||||
{
|
||||
label: MailPoet.I18n.t('customFieldValidateNothing'),
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: MailPoet.I18n.t('customFieldValidateNumbersOnly'),
|
||||
value: 'alphanum',
|
||||
},
|
||||
{
|
||||
label: MailPoet.I18n.t('customFieldValidateAlphanumerical'),
|
||||
value: 'number',
|
||||
},
|
||||
{
|
||||
label: MailPoet.I18n.t('customFieldValidatePhoneNumber'),
|
||||
value: 'phone',
|
||||
},
|
||||
]}
|
||||
onChange={(validate) => (setAttributes({ validate }))}
|
||||
/>
|
||||
</PanelBody>
|
||||
</Panel>
|
||||
|
||||
|
Reference in New Issue
Block a user