Hello,
We're looking for a simple way of adding an alert box whenever adding an attachment (for juridical reasons).
Once i've was given from the support a trick to fill in the description field with some text by adding the following javascript to the field's label in the field configuration:
{noformat}
<script type="text/javascript">
AJS.$(document).ready(function() {
if (AJS.$(#description) 0 .value == ) {AJS.$(#description) 0 .value = some text; }});
</script>
{noformat}
Now i've been trying to do the same for the attachment field, to no avail. So i thought maybe you could help me.
What i want is that any time you add a file to attach it to an issue, a javascript alert box should popup.
In a simple html file i would do like this:
{noformat}
<input type="file" onchange="alert('When" uploading="" attachment,="" blablabla');=""/>
{noformat}
Unfortunately i could not find where the attachment field is generated or where i should put my simple javascript code.
Do you have an idea? It would help us a lot
If you'd rather just put a message in the attachment popup instead so that the warning is given without being so annoying, the template file would be
atlassian-jira\secure\views\issue\attachFile.jsp
but any change here would need to be re-applied any time you did an upgrade
You don't say if it's jira4 or jira5... what should work for both is:
AJS.$("#attachment_box").live("change", function () {alert("blah")})
(within the document ready handler).
To ensure this javascript gets on every page you need a plugin with a webresource context of jira.general. Or you can just put it in the announcement banner (bit ugly though).
I think you should also do something to limit it to only showing the alert on the first attachment added, or once per month etc, to reduce annoyance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.