New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve form input validation (ValidateLength, ValidatePattern, etc.) #417

Closed
apetitjean opened this Issue Oct 29, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@apetitjean
Copy link

apetitjean commented Oct 29, 2018

Please improve form input validation methods.

I want to use UD as a day-to-day tool but currently with the actual limitations of the forms I cannot. In my scenario, this is a blocker for broadly adoption in the company I work for and the companies I work with.

ValidateLength, and ValidatePattern decorators make the form hang when they are triggered.

I haven't tested all the decorators but what I need is:

  • Length validation,
  • Regex pattern validation,
  • Range validation (~ValidateRange)
  • Null or emptiness (~ValidateNotNullOrEmpty)
  • ValidateSet : worked today in the actual implementation. But it would be great if you could provide a mecanism to make it more dynamic. I mean it's not easy to pass a dynamically constructed list of values.

It would be awesome if the validation occured on the client side.
Thanks Adam! ;-)

@adamdriscoll

This comment has been minimized.

Copy link
Member

adamdriscoll commented Nov 11, 2018

Check this out:

validation

New-UDInput -Title 'Test' -Endpoint {
     param(
                [ValidatePattern('.*Rules.*')]
                $String
     )
}

It doesn't actually work client side but it will work with any validation attribute. I have a bit more work but would love your feedback. If you want to play with it, try the latest build here: https://ci.appveyor.com/project/adamdriscoll/universal-dashboard/builds/20213996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment