0
votes

more jira issues. I've got a customfield that i've atatched a change() method to. The plan is to update the built in version field when my custom field changes but at the moment the code never gets executed.

<script type="text/javascript">
 jQuery(function($){
   $('#customfield_10004').change(function(){
      alert("changing");
      $('#versions').val($('#customfield_10004 option:selected').val());
      alert($('#customfield_10004 option:selected').val());
   });
 });
</script>

I never get to the popup window.

The customfield_10004 is a single version picker and the versions is the built in affected Version/s field. The reason i'm doing this is i dont want a user to select more than one version but i dont know where or how to put some conditions on the built in field.

Lots of plugins rely on this built in field so i need it to be set somehow.

1
Can you post the markup this goes with? - Nick Craver

1 Answers

0
votes

Did you make sure that the jQuery is enabled? try running the commands in the development console.

Another solution is using the JIRA Behaviours Plugin to change the value of versions to the value of the custom field, by running a code similar to this:

FormField cf = getFieldByName("customfield_10004")
FormField ver = getFieldByName("versions")

ver.setFormValue(cf.getFormValue())