Hello!
I have a requirement to add the value of a parameter to a page as a label.
The user macro is a subset of fields we are asking our users to provide. In this example We are asking for a Document Number. The user provides this number and I wanted to add this as a label to the page. The macro below includes a script that adds a Box with a plus icon. The user would enter the label and click on add. I thought that I could reuse some of this macro to add a label but haven't been able to achieve this. Ideally the user would not be able to see the input box or the add icon. The code would take the $paramDocNum and add it to the label.
Any suggestions would be greatly appreciated.
Melissa
## @param DocNum:title=Document Number |type=string|required=false|desc=Enter your Document ID #
<script>
var addLabel = function(label) {
jQuery.post(contextPath + "/json/addlabelactivity.action", {"entityIdString": "$content.id", "labelString": label, "atl_token": jQuery("#atlassian-token").attr("content") }, function() {
jQuery("#label-to-add").val("");
});
}
</script>
<form class="aui" onsubmit="return false;">
<input id="label-to-add" class="text">
<button class="aui-button aui-button-subtle" onclick="addLabel(jQuery('#label-to-add').val());">
<span class="aui-icon aui-icon-small aui-iconfont-add">Add </span>
</button>
</form>
<br>
<tr>
<td>Document ID #<br></td>
<td> $paramDocNum
</td>
</tr>