Extend the dialog field validation to use custom method


#1

It would be great to be able to create our own validation methods for dialog fields. At the moment, we can only validate against a regular expression. I would like to be able to call some external API to check that some data is valid : like hostname against IPAM, etc…


#2

+1

That’s a coincidence, we discussed exactly this requirement on a project I’m on at the moment. The particular use case was to prompt for the VM name in a dialog, and run a background validation method to see of the VM name already exists.

pemcg


#3

So, essentially similar to how Dynamic drop downs work with a refresh button, except for other fields?

Or would this check happen after hitting submit?


#4

Yeah better dialog-scripting would be nice to have. regexp validation is good. It’s not nice for a enduser if validation happens after submit and order fails.

Other thing which would be good (not sure if this is possible on current version) that you could take values from other dialog items and use those on other. eg. if you have a dev/prod selection, the next questions could be like list of resource pools based on dev/prod -selection.


#5

@jsimonelli
Ideally, this check would be performed on change. When adding a validation method in the dialog designer, I would see a validation trigger option : on change, on submit. Like it is done in a lot of forms I had to fill : google checks the email address you want to register is available, for example.

Additionnaly, when designing a dialog with a dynamic drop down list, I would like to be able to add a dependency on other fields. Then, when one of the dependencies changes it would trigger a reload of the dynamic drop down list. This would remove the need for a refresh button and answer the suggestion of @tonimaatta.


#6

Yep, I can do my use case already, but hitting that refresh button is pretty old-school way to do things… :smile:


#7

@fdupont that would require some ajax type form, and some synchronous feedback… which would be AWESOME to have…

I have used a set of dynamic drop downs where I hit refresh on the second and uses the fields of the first dynamic drop down… This works for my use case but it is a complete hack and workaround. I like where this conversation is going because we all want the same thing. MORE OPTIONS! :smile:


#8

Well, how do we make it move forward ?