Skip to content
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

Ability to customize validation failure message for custom dialog elements #21567

Closed
bfilion87 opened this issue Nov 18, 2021 · 10 comments
Closed
Assignees

Comments

@bfilion87
Copy link

Currently it is not possible to directly update the validation failure message within a custom dialog Text Box element. The default message is set to "Entered text should match the format:') + ' ' + regexPattern", would be awesome to be able to customize this message displayed to users.

@Fryguy
Copy link
Member

Fryguy commented Nov 18, 2021

@brandonfilion Can you copy that screenshot you had in gitter to here?


@akhilkr128 Can you take a look at this one? I dug in a little bit and found this unrelated but interesting bit in the kubevirt dialogs: https://github.com/ManageIQ/manageiq-providers-kubevirt/blob/0a0f34325f84a543502f6e8e7de9a2726d1c81bc/content/miq_dialogs/miq_provision_kubevirt_dialogs_template.yaml#L187-L188

It looks like the dialogs possibly already have a way to set a required_regex_fail_details key, but I'm not sure those can be used for custom dialogs which is what this is about. I think it would be a very useful feature to support this, though.

Here's the code using it:

def validate_regex(_field, _values, dlg, fld, value)
regex = fld[:required_regex]
return _("%{name} is required") % {:name => required_description(dlg, fld)} if value.blank?
unless value.match(regex)
error = _("%{name} must be correctly formatted") % {:name => required_description(dlg, fld)}
error << _(". %{details}") % {:details => fld[:required_regex_fail_details] } if fld[:required_regex_fail_details]
error
end
end

@bfilion87
Copy link
Author

image

@akhilkr128
Copy link
Member

Working on this will update the findings here.

@akhilkr128
Copy link
Member

@Fryguy. Yes, we can add a fail message option under validator field.
Screenshot 2022-02-02 at 11 50 17 AM
Working on this.

@akhilkr128
Copy link
Member

This change resides under the angular space https://github.com/ManageIQ/ui-components. I can see that we have a plan to change this view to react ManageIQ/manageiq-ui-classic#7603. @Fryguy/ @chessbyte, do I need to wait for the react conversion? Or can I move forward with angular for now?

@chessbyte
Copy link
Member

@Fryguy/ @chessbyte, do I need to wait for the react conversion? Or can I move forward with angular for now?

@kavyanekkalapu what are your thoughts on this?

@kavyanekkalapu
Copy link
Member

kavyanekkalapu commented Mar 22, 2022

@akhilkr128 I would suggest to go a head and do it in angular. We have a long way to convert ui-components to react.

@akhilkr128
Copy link
Member

Sure, I feel the same.

@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2023

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot
Copy link
Member

miq-bot commented May 29, 2023

This issue has been automatically closed because it has not been updated for at least 3 months.

Feel free to reopen this issue if this issue is still valid.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot closed this as completed May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants