How to clear custom field when using 'Create another' option

Hi,

I realise literally hundreds of people asked for custom fields to behave exctly as they currently do when using the 'Create another' option in the create issue dialog window (the values persist), but ironically I have a customer who wants to clear the current selections when they click the 'Create' button on the bottom right of the window.

I've been trying to do this with JavaScript, but it does not work using the 'onsubmit' function. I have tested the basic code by temporarily using onclick, and it does clear the custom field. Obviously that's a bit useless as I want the selections submitted the first time... Here is what I have so far  - any suggestions ? 

<script type="text/javascript">
target = document.getElementById("customfield_10500");
function clear()
{
target.value = "";
}
var create = document.getElementById("create-issue-submit");
create.onclick=clear; // I need something like send my CF values now, and then onsubmit complete =clear
</script>

1 answer

I have tried with with  some time-delayed JavaScript, but does't work either sad

<script type="text/javascript">
var createForm = document.getElementById("create-issue-submit");
createForm.onclick=timeout_init;
function timeout_init() {
    setTimeout('timeout_action()', 2000);
	//document.getElementById("customfield_10500").value = '';
    //This will clear field, but don't want to clear at this instant....	
}
function timeout_action() {
    window.alert('I waited this long');	
    document.getElementById("customfield_10500").value = '';
	// alert is shown after 2 seconds, but value does not clear
}
</script>

I wonder (when using Create another option ) is the create issue screen for the first issue created actually closing, and a new version of it is being displayed, quicker than I can observe, for the second and subsequent issues? maybe my clear command looses context or reference to the original object its trying to work on...

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 3 hours ago in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

22 views 0 2
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