mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Use regex test instead of match (#1016)
This commit is contained in:
parent
9beec28eeb
commit
a294a3b977
1 changed files with 2 additions and 2 deletions
|
|
@ -37,14 +37,14 @@ class ManageOrgUsers extends React.Component {
|
||||||
if (!fields['firstName']) {
|
if (!fields['firstName']) {
|
||||||
errors['firstName'] = 'This field is required';
|
errors['firstName'] = 'This field is required';
|
||||||
} else if (typeof fields['firstName'] !== 'undefined') {
|
} else if (typeof fields['firstName'] !== 'undefined') {
|
||||||
if (!fields['firstName'].match(/^[a-zA-Z]+$/)) {
|
if (!/^[a-zA-Z]+$/.test(fields['firstName'])) {
|
||||||
errors['firstName'] = 'Only letters are allowed';
|
errors['firstName'] = 'Only letters are allowed';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fields['lastName']) {
|
if (!fields['lastName']) {
|
||||||
errors['lastName'] = 'This field is required';
|
errors['lastName'] = 'This field is required';
|
||||||
} else if (typeof fields['lastName'] !== 'undefined') {
|
} else if (typeof fields['lastName'] !== 'undefined') {
|
||||||
if (!fields['lastName'].match(/^[a-zA-Z]+$/)) {
|
if (!/^[a-zA-Z]+$/.test(fields['lastName'])) {
|
||||||
errors['lastName'] = 'Only letters are allowed';
|
errors['lastName'] = 'Only letters are allowed';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue