Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// See https://reactjs.org/docs/events.html#event-pooling.
e.persist();
validate();
}
};
return (
<div>
<label>
</label>
<input> onChange(e.target.value)}
value={value}
placeholder={I18NValue(props.field.placeholderText)}
type={props.type}
name={props.field.fieldId}
id={props.field.fieldId}
className="webiny-pb-form-field__input"
/>
}
/>
</div>
);
};
return async value => {
let isInvalid = true;
try {
const result = await validatorPlugin.validator.validate(
value,
item
);
isInvalid = result === false;
} catch (e) {
isInvalid = true;
}
if (isInvalid) {
throw new Error(
I18NValue({ value: item.message }) || "Invalid value."
);
}
};
})
const getFieldValueLabel = (field, value) => {
if (field.options.length > 0) {
const selectedOption = field.options.find(option => option.value === value);
if (selectedOption) {
return I18NValue(selectedOption.label);
}
}
return value;
};