how to retrieve custom field value in confluence

I am trying to get the space name from my custom form for creation of space

3 answers

0 vote
Colin Goudie Community Champion Apr 25, 2013

Can you provide some more information of what you currently have? Where and what is your custom form? Is it in a plugin, rendered in a macro or what? Is it then trying to create a space?

this is my velocity file

<u><u></u></u>

<html>

<u><u></u></u>

<head>

<title>publishing a space</title>

<meta name="decorator" content="atl.admin" />

$webResourceManager.requireResource("com.atlassian.auiplugin:ajs")

</head>

<body>

<form name="myForm" action="com/atlassian/plugins/vanderlande/publishspace/myaction.action" method="GET">

$action.inputText: <input type="text" name="myInput">

<div class="field-group">

<label for="name">Name</label>

<input id="spacename" type="text" name="name" >

</div>

<div class="field-group">

<input type="submit" value="ok" class="text">

</div>

<div class="field-group">

<input type="submit" value="cancel" class="button">

</div>

</form>

</body>

</html>

this is my ijs file

<font><font><font></font></font></font>

AJS.toInit(

<font><font><font></font>function<font>() {</font></font></font>

var baseUrl = AJS.$("meta[name='application-base-url']").attr("content"<font>);</font>

function<font> populateForm() {</font>

AJS.$.ajax({

<font></font>

url: baseUrl +

<font></font>"/rest/plugins/vanderlande/publishspace/MyAction"<font>,</font><font></font>

dataType:

<font></font>"json"<font>,</font><font></font>

success:

<font></font>function<font>() {</font><font></font>

AJS.$(

<font></font>"#name").attr("value"<font>, config.name)</font>

} });

function<font> updateConfig() {</font>

AJS.$.ajax({

<font></font>

url: baseUrl +

<font></font>"/rest/publishspace/1.0/"<font>,</font><font></font>

type:

<font></font>"PUT"<font>,</font><font></font>

contentType:

<font></font>"application/json"<font>,</font><font></font>

data:

<font></font>'{ "name": "' + AJS.$("#name").attr("value")+')'<font>,</font><font></font>

processData:

<font></font>false<font> })};} </font>

populateForm();});

<font></font>

AJS.$(

<font></font>"#publish").submit(function<font>(e) {</font>

e.preventDefault();

updateConfig();

});

my form display but i alway get error. rest does not work. so i cann't retrieve data from the form I want to create a space from java and reference the copyspace

it is a plugin

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

374 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you