Input element causes stuck on drop down menu

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

This widget could not be displayed.
Joe Clark Atlassian Team Mar 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 :-)

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 Chin Community Champion Jan 08, 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"

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 Chin Community Champion Feb 06, 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.

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

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

141 views 16 7
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