Handle data in form submission

35 views
Skip to first unread message

Valentina

unread,
Jul 1, 2020, 7:40:52 AM7/1/20
to Jenkins Developers
Hi everyone,

I am new in the Jenkins world, I started to use Jenkins from this April and I am developing a new plugin.
However, I am having some problems to understand how the jenkins environment works exactly. 

The main idea is to create a Jenkins plugin which can show the content of a JSON file produced from the build of a freestyle project into a table format. Each row of the table should also contains additional checkboxes and text areas such that a user can add additional information.

Currently, I was able to realize the table with the JSON content and add the checkboxes and textareas (using SimpleBuilderStep and RunAction2 classes), but I do not know how to handle the data when I click on the submit button. 

I would like to use the checkboxes values and text areas in order to perform other operations, such as create a new file in the workspace or send information to another endpoint like elasticsearch.

Do you know any possible solution? 

Thank you in advance,
Best regards.

Valentina


Jesse Glick

unread,
Jul 1, 2020, 8:27:11 AM7/1/20
to Jenkins Dev
On Wed, Jul 1, 2020 at 7:40 AM Valentina <odorizzi...@gmail.com> wrote:
> […] I do not know how to handle the data when I click on the submit button.
>
> I would like to use the checkboxes values and text areas in order to perform other operations, such as create a new file in the workspace or send information to another endpoint like elasticsearch.

This does not sound like a standard Jenkins configuration form, so the
usual links about “structured form submission” and typical controls
like `f:textbox` are probably irrelevant. If you have managed to
render an HTML form with the desired contents, you can just set the
submission `action` to be a web method in your action

HttpResponse doSubmit(StaplerRequest req)

and write the body like any servlet handler.

Valentina

unread,
Jul 1, 2020, 11:01:35 AM7/1/20
to Jenkins Developers
Thank you very much for your suggestion. 
I solved using Javascript method in order to call a method in my action class. 

Best regards.
Valentina
Reply all
Reply to author
Forward
0 new messages