bugy / script-server

Web UI for your scripts with execution management
Other
1.61k stars 249 forks source link

[WiP] Textfield to support RegExp validation #459

Closed drehelis closed 1 year ago

drehelis commented 3 years ago

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 -

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

ashishp0911 commented 1 year ago

Hello , This doesn't seem to work. I tried the exact pattern mentioned in this thread , but there doesn't seem to be any validation on the Input Field or am I missing something

The parameter section below : -

"parameters": [ { "name": "Input", "required": true, "param": "-i", "envvar": "INP", "type": "text", "regex": { "pattern": "^([a-z0-9\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$", "description": "Input Validation" } }

Regards, Ashish .A. Poojary

bugy commented 1 year ago

Hi @ashishp0911, how did you test it? This PR was not merged, i.e. not available in script server builds.

ashishp0911 commented 1 year ago

@bugy My Bad , I spoke too early. I mistook the closed case #466 and thought this feature has been implemented in the latest build. Any updates on the rollout of this feature ?

bugy commented 1 year ago

I have to apologize to @drehelis for missing that one. To be honest I was waiting for "review request", but I had to check this ticket on my own. Totally my fault for not tracking the project properly.

I made some minor adjustments, and will wait for build before merging. Probably tomorrow.