Can we create an action form in a Confluence page?

Eduardo Mendes November 16, 2012

Hi everyone,

I would like to create an action form in one of my company's Confluence pages, where a client may fill in a few input fields, and then press "Submit". Upon submit, an http POST request would be performed, to a certain URL with a few parameters built from the form fields.

Is this possible at all in Confluence. Is there any documentation I can have a look at about this, or could you maybe provide me with instructions about how I could possibly achieve this?

Thanks a lot!

Eduardo

3 answers

1 accepted

0 votes
Answer accepted
Eduardo Mendes November 21, 2012

Thanks for the contributions. After analyzing pros & cons, I have decided for a different alternative. Since the site I want to submit to is a JIRA instance, I will use its REST API.

It also looks like you can create a simple html form in any confluence page, and include it in an html macro, to achieve this.

Alexander Schermann March 16, 2020

looks like?

1 vote
tousifs
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2012

Hi Mendes,

I have similar line of requirement where i have created macro which was holding the page and it has .vm ui display where i have given action and able to achive customized requirement.

you can also achive the same way.

Regards,

tousif shaikh

Eduardo Mendes November 18, 2012

Thanks Tousif. Do you think you could send me an example of this?

tousifs
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2012
1 vote
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2012

Run Plugin for Confluence can provide the form and for the body of the macro you may need to use html or a script (Script Plugin for Confluence) depending on what you want to do. Use insert wiki markup for the run macro.

Eduardo Mendes November 16, 2012

Hi Bob,

Thanks for the feedback. I have installed the Run Plugin for Confluence v3.0.0, and entered the 30-day license key. My Plugin Manager (I am using Confluence 4.2.8) tells me the Plugin is enabled.

However, when editing any Confluence page, I do not find a way to insert this plugin. e.g. if I start typing '{ru' the autocomplete does not find any matches, and neither if I go directly to the macro browser.

Could I be missing a particular setup step? Or could it be that the Confluence version I am running is not supported?

Thanks a lot for your help.

Best regards,

Eduardo

Eduardo Mendes November 18, 2012

Thanks for the feedback. Do you think you could send me a small configuration example, about how I could do the following: Upon clicking on the 'Run' button, the following url post request would be made -> http://www.myapp.com/index.jsp&priority=high

Where 'high' would be read from an input field of the form created.

If this macro can do this, then my company will definitely buy a license for it. I just wanted to be sure it will do what we need, before purchasing.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2012

I think you would need something similar to the following translated to groovy from https://discursive.atlassian.net/wiki/display/CJCOOK/Making+an+HTTP+POST+Request:

{run:replace=priority:high:Priority of request}
{groovy}
import org.apache.commons.httpclient.HttpClient
import org.apache.commons.httpclient.HttpException
import org.apache.commons.httpclient.NameValuePair
import org.apache.commons.httpclient.methods.PostMethod
HttpClient client = new HttpClient()
        
def url = "http://wwww.myapp.com"

// Create POST method
def method = new PostMethod(url)

// Set parameters on POST    
method.setParameter("priority", "$priority")  // <---- run macro will substitute in here

// Execute and print response
try {
    client.executeMethod(method)
    String response = method.getResponseBodyAsString()
    out.println(response)
} catch(Exception exception) {
    out.println(exception.toString())
} finally {
    method.releaseConnection()
}
{groovy}
{run}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events