Input element causes stuck on drop down menu

moretime moretime March 14, 2012

Hi all,

I have a plugin in JIRA 5.0 using Web work.

In input.vm, I place an File input element. Using Web item to navigate to plugin.

After open my plugin, all drop down menus are stuck. Nothing happen when clicking on it.

It does not happen when I remove File input element.

Anyone could explain this and how can I use Input file element in file .vm?

Thanks in advance,

2 answers

1 vote
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2012

You should check the JavaScript console from any errors that occur during the page load.

Is your input element wrapped within a form? If not, it probably should be :-)

moretime moretime March 15, 2012
Thanks Joseph so much, It seems you guide me the right way. My form contains only input file element. But I got JS error: "uncaught exception: Unable to find maximum upload size on form." I think this is required by Jira 5.0 I try to set upload size of the input file element but unsuccessfully. Do you know to to set this value? Thanks in advance,
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 8, 2013

Oh the joy. Somehow, when using an type="file" input tag, Atlassian's Javascript asks for two tags to be in the form:

  1. A div where the id is "attach-max-size"
  2. An input field where the name is "id"

Bart Gottschalk February 6, 2013

Timothy,

You seem to have figured this out. Adding the elements you described isn't resolving the error for me. Can you provide more details on what you added to your form? Here is the content of my form:

<input type="hidden" name="pID" value="$metadata.projectID">
								<input type="hidden" name="pDocAO" value="$pDocAO">
								<input id="fileToUploadInput" type="file" name="attach1" size="30">
								<input type="hidden" name="id" value="">
								<div id="attach-max-size"></div>

But I still get the same error.

Thanks.

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2013

Just think of it in this way. If you use the input="file", AJS will pick up on it and will act on in. Therefore, you can refer to how JIRA does the file import.

So, if you provide id's without values, it's definately not going to work.

<div id="attach-max-size" class="hidden">$attachmentSize</div>

<input type="hidden" id="id" name="id" value="$randomId" />

Note, both my values have meaning. The attachment size is JIRA's attachment size limit. Random Id is the id of the issue that I am refering to.

Bart Gottschalk February 6, 2013

Timothy,

Thanks for the clarification. I've explored your suggestions and it works as you describe.

I'm upgrading a custom plugin from 4.4.x to 5.2.5 and one of the things we do in this plugin is provide the ability to attach files at the project level, not just at the issue level. I'm not just providing a different way to create issue attachments. So, the restriction to match an issue id is not applicable. To your knowledge, is there a way to override or skip this built-in validation? It's quite annoying for my purposes.

I don't want any of Atlassian's fancy javascript validation or form manipulation for file uploads. I just want to control the UI and form elements myself. This includess not having the js code convert the input type="file" element to a checkbox for multiple file uploads. I want to shut this code off. Ideas?

Thanks

Bart Gottschalk February 6, 2013

I found the answer and it is documented here: How to ignore-inline-attach.

This is exactly the type of solution I was hoping to find. Very easy.

0 votes
Suresh Sakhare
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2017

Try this code. It work for me.

<div class="field-group">
<label class="field-label" for="attachment">Attachment <span class="vp-optional">(optional)</span></label>
<div class="field-container">
<div id="attach-max-size" class="hidden">15728640</div>
<input id="attachment" type="file" name="attachment"/>
<div class="hidden"><input type="hidden" value="14000" name="pid"></div>
</div>
</div>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events