script-server
script-server copied to clipboard
[WiP] Textfield to support RegExp validation
I was in a need for special form of text field validation done on the frontend. This PR tries to solve this by adding regular-expression validation capabilities.
Couple of caveats -
- Escaping characters such as
\when editing JSON config manually is required. - ~~Can't get the Admin UI properly generate
regexobject. Hence, WiP :-)~~ - Add Tests
Parameter config should look like:
{
"name": "RegExp textfield",
"max_length": "12",
"regex": {
"pattern": "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$",
"description": "Email address only"
}
}
Small demo:
https://user-images.githubusercontent.com/11921235/121894690-1afb6100-cd28-11eb-8b36-a59df6a3c53f.mov