How can I add a custom validation in the Input plugin

I am writing a new plugin and I want to add a custom validation for a text field to check for a particular format and display in the UI itself before saving the Input. Is there any way to do this check ?

Hi @sagarinpursue,

sure you can. You could add a validation before submitting your input. I am not sure what your question aims at right now.

Greets,
Konrad

Hi @konrad,

Thanks for the reply.
Sorry for not being clear about my question.

I am trying to create my own input plugin with additional fields. Here in the below image you see the Source Ip Text field and I want to validate for the particular format of the IP from the front end.
I do not have access for the graylog server code (If I had I would have added my validation snippet in the validation.js file). Instead I want to write UI validations from the plugin code and display the error message “Please enter in the given format” in the UI before saving the inputs. Please let me know all the possibilities in doing this. Thanks in advance.

image

Hi @sagarinpursue,

i am sorry, I think you were quite clear in your question, I was just not grasping it right along.

What you want to archive is not possible right now as the code is. But it is a really good idea and it would be logical to have a IP validation for Inputs. Would you be so kind and open a feature request on github?

Thanks for your contribution!

Konrad

Hi @konrad,

Thanks for the confirmation on the validation part.
Sure thing. I will raise a feature request on github.

I would like to know process of the feature request, like when will the request be processed and implemented and released. How much duration does it take ?

Any information on this would be helpful.

Regards,
Sagar R

To be honest, it depends. If it is not a big deal to do, I can do it in between and we can even consider backporting it to earlier releases. But when it is a bit more complicated, then I can’t promise to much.
If you are willing to take a look yourself a pull request is always welcome and you can add me as a reviewer!

Regards,
Konrad

Sure.
There should not be much change as we are adding a validation in the IP format of the input.
I will see if I can raise pull request and will add you as reviewer.
Thanks for the suggestion.

Regards,
Sagar R

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.