Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,657
Community Members
 
Community Events
165
Community Groups

Issue Collector - How to gather input fields value on Show Dialog

Hi,

I followed the documentation for Issue Collector and I was able to create a webpage with a button that can now show a Dialog to open a ticket in a specific JIRA project. I am even able to provide Default values for some fields by adding this code:

// ==== default field values ====
fieldValues : {
summary : 'This is the default summary value'
}

 And it is pretty sweet.

However I would like to upgrade this feature and to be able to pass values instead of only defining defaults one with "fieldValues".

In a way, this is what I am trying to do:

// ==== we add the code below to set the field values ====
"fieldValues": {
summary : $('#summary').val(),
description : $('#description').val()
}

<body>

<input id="summary" name="summary" type="text" value="" />
<input id="description" name="description" type="text" value="" />

</body>

 

This is a simplified version of my code, but I think it should shows what I am trying to do.

The problem is that the code $('#summary').val() is not called when we click on the button and trigger the function showCollectorDialog();. So the values I am trying to get from the inputs are never gathered back to the Dialog.

I am at lost to try and find a way to solve this.

Any help is appreciated.

Thank you

1 answer

1 accepted

I have found how to do it.

I will post here, hopefully this will help someone. Atlassian should update their doc on Issue collector as this is not easy at all to understand.

window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
//Requries that jQuery is available!
jQuery("#feedback-button").click(function(e) {
e.preventDefault();

//This is the new function you need to add
updateFieldValues();

showCollectorDialog();
}
});
},
// ==== Set the default field values if nothing is shared by the user ====
"fieldValues": {
summary : 'A Summary text',
description : 'The description',
priority : '10004',
}
};

function updateFieldValues()
{

// Using JQuery, go gather your values.

window.ATL_JQ_PAGE_PROPS.fieldValues.fullname = $('#fullname').val();

window.ATL_JQ_PAGE_PROPS.fieldValues.components = $('#components').val();

window.ATL_JQ_PAGE_PROPS.fieldValues.description = $('#description').val();

// Etc...

}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you