-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add support for validations to pfFilterFields (filterType: text) #761
Comments
Hi @vbusch, can you please provide a real world example of the type of validation(s) you are looking for? Thanks, it will help me understand what you are looking for. |
@dtaylor113, we are using the filter to filter a very large list(pf-list-view) of potentially 1000,000 items. We provide them 2 ways to filter. The first is by type, and we are using filterType=select, which works great. They also want to be able to filter by name. And in order for it to be flexible enough, we need to allow them to search for 'queueA*' or 'queue*small', which would return queueA1, queueA2, queue1small, queue2small etc. The actual validation we are using on the name is ensuring "new RegExp(filter.value)" doesn't throw an exception. If they enter something like '**A', or any value that the RegExp can't handle, we want the user to receive a validation exception in the normal fashion (input field, outlined in red, with an error message). |
Hi @vbusch, thank you for the example. Can you provide a link to some code illustrating how/where you use "new RegExp(filter.value)"? -thanks |
@dtaylor113 I would like to add a validator to line 249 in https://github.com/vbusch/enmasse/blob/console-1626/agent/www/components/addresses/addresses_ctrl.js#L243-L262 The current validation is: The html can be found https://github.com/vbusch/enmasse/blob/console-1626/agent/www/components/addresses/addresses.html Let me know, if you would like me to extract the code into something easier to run. |
Hi @vbusch, I see your HTML is structured as:
Which indicates that you are using the older angular-patternfly v3. The current version of angular-patternfly is v4 where we have changed all attribute directives to component tags (see Unfortunately, we do not have the filter validation you are looking for. We could possibly investigate adding it to angular-patternfly v4, but it is unlikely we would be able to add it to the older angular-patternlfy v3. You could look into customizing the angular-patternfly v3 Filter components and add the validation you require. The v3 filter components are located here. You could copy the source code into your own custom package. It would require adding classes HTH, |
Using pfFilter, and would like to be able to add validation to a filterType: 'text' field. Either be able to add a custom directive or pfValidation to pfFilter.fields
Our use case is, any value that is a legal regular expression is valid.
The text was updated successfully, but these errors were encountered: