-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from unicef/feature/add-regex-validation-to-t…
…ext-validation PR to add matchRegexpCaseInSensitive rule to ValidatorForm
- Loading branch information
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ export default function FormValidator() { | |
const [values, setValues] = useState({ | ||
currency: '', | ||
email: '[email protected]', | ||
regex: '', | ||
password: 'testinghere', | ||
positiveInteger: 1, | ||
currencyField: 1000.55, | ||
|
@@ -325,6 +326,19 @@ export default function FormValidator() { | |
value={values.safeText} | ||
/> | ||
</Grid> | ||
<Grid item xs={12} lg={3} xl={2}> | ||
<UTextField | ||
label="Custom regex(no script)" | ||
onChange={handleValue} | ||
className={classes.margin} | ||
name="regex" | ||
variant="outlined" | ||
validators={[ | ||
'matchRegexpCaseInSensitive:^(?!.*<script\\b[^>]*>.*<\\/script\\s*>).*$', | ||
]} | ||
value={values.regex} | ||
/> | ||
</Grid> | ||
<Grid item xs={12} lg={3} xl={2}> | ||
<UTextField | ||
label="Alphanumeric" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters