Nailed phone number input

This commit is contained in:
Pieter Vander Vennet 2020-09-26 21:00:03 +02:00
parent 585a4243f7
commit 07c85bb218
3 changed files with 52 additions and 19 deletions

View file

@ -326,15 +326,13 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
}
let formatter = ValidatedTextField.AllTypes[type].reformat ?? ((str) => str);
const pickString =
(string: any) => {
if (string === "" || string === undefined) {
return undefined;
}
const tag = new Tag(freeform.key, formatter(string, this._source.data._country));
const tag = new Tag(freeform.key, string);
if (freeform.extraTags === undefined) {
return tag;
@ -361,11 +359,14 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
return undefined;
}
console.log("Creating a freeform input element for ", this._source.data._country);
return ValidatedTextField.Mapped(pickString, toString, {
placeholder: this._freeform.placeholder,
type: type,
isValid: (str) => (str.length <= 255),
textArea: isTextArea
textArea: isTextArea,
country: this._source.data._country
})
}