Handle data in form submission

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Handle data in form submission

Valentina
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


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/05859270-9f57-4281-8531-6912e5cea359o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Handle data in form submission

Jesse Glick-4
On Wed, Jul 1, 2020 at 7:40 AM Valentina <[hidden email]> 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.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3Wkgn6hkCmbRc1RLGFroNNPji2jZaw%3DB3xuU9jJ%2BJm2g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Handle data in form submission

Valentina
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


Il giorno mercoledì 1 luglio 2020 14:27:11 UTC+2, Jesse Glick ha scritto:
On Wed, Jul 1, 2020 at 7:40 AM Valentina <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="I_LPiLZ0BgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">odorizzi...@...> 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.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/e191a8d3-9400-49ad-84db-d08b524c2b41o%40googlegroups.com.