a

>>Bugs>> [Fixed in 1.3.16] MultiFile does not display when placed in a hidden div
Pages: 1   reply
Author [Fixed in 1.3.16] MultiFile does not display when placed in a hidden div
Chris Newman
Total Posts: 3
MultiFile does not display when placed in a hidden div
5/5/2009 9:43:03 AM
Im using a MultiFile control that is placed in a div hidden via css. When i show this div using javascript, the MultiFile control does not display.

Firebug is reporting that the control has a width and height set to 0px;

I created a sample page with nothing in it to try to narrow down the bug...


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
   
    <img src="images/menuHome.jpg" onclick="test();" />
    <div id="di" style="display:none;">
        before
        <br />
        <Upload:MultiFile ID="inputFileId" runat="server" UseFlashIfAvailable="true" />
        <br />
        after
    </div>
    </form>
   
    <script type="text/javascript">
        function test() {
            $("#di").show();
            //NeatUploadMultiFile.prototype.Controls['inputFileId'].RefreshDisplay();
        }
    </script>
</body>
</html>


I attempted to modify the NeatUpload.js with a fix i seen in another post with the RefreshDisplay function (now commented out) but it is still not displaying.


I am only able to get this to display when i remove the js code that is setting the height and width of the replacementDiv.

I changed these 2 lines in the MoveAndResizeDivAndAddFlash() function

height = replacementDiv.style.height = replacementDiv.offsetHeight + "px";   line 1312
width = replacementDiv.style.width = w + "px";                                          line 1318

to

height = replacementDiv.offsetHeight + "px";
width = w + "px";










  <a href='http://www.phase9studios.com'>http://www.phase9studios.com</a>
guest
Total Posts:
Re: MultiFile does not display when placed in a hidden div
5/5/2009 11:09:44 AM
Well after further testing, this is not working out so well.
Clicking "Pick Files" does not do anything now with the js modified.

 
Chris Newman
Total Posts: 3
Re: MultiFile does not display when placed in a hidden div
5/5/2009 3:28:31 PM
After some testing i found something that works for now.

I added this
numf.RefreshDisplay = MoveAndResizeDivAndAddFlash;
to the StyleInputFileAndAddFlash(inputFile) function
from this thread

modified the MoveAndResizeDivAndAddFlash() function

from
height = replacementDiv.style.height = replacementDiv.offsetHeight + "px";

to
height = replacementDiv.style.height;
as replacementDiv.offsetHeight was always returning 0 after displaying the hidden div

I left the width line the same as it would return a proper value.



In my client side code after I display the div i call the RefreashDisplay function and it works properly.
NeatUploadMultiFile.prototype.Controls['ctl00_ContentPlaceHolder1_inputFileId'].RefreshDisplay();

  <a href='http://www.phase9studios.com'>http://www.phase9studios.com</a>
Dean Brettle
Total Posts: 2015
Re: MultiFile does not display when placed in a hidden div
5/5/2009 4:20:33 PM
What browser version are you using?
--Dean

 
Chris Newman
Total Posts: 3
Re: MultiFile does not display when placed in a hidden div
5/5/2009 5:25:53 PM
FireFox 3.0.10  and IE 8
I did not test with other browsers.

  <a href='http://www.phase9studios.com'>http://www.phase9studios.com</a>
Dean Brettle
Total Posts: 2015
Re: MultiFile does not display when placed in a hidden div
5/7/2009 10:50:09 AM
Sounds like you have a workaround, but there are a couple other things you could try.

Proposal #1. Leave the "= replacementDiv.offsetHeight..." bit but after showing the div, use window.setTimeout() to call RefreshDisplay() after a short delay.  That might give the browser a chance to update the DOM and the value of offsetHeight based on the size of your div.
Proposal #2. Initially display the div, and then hide it using JS in an onload handler.  Again, that might be sufficient to allow offsetHeight to have a valid value.  If this works, you might prefer it since it would mean you could use an unaltered copy of NeatUpload.

I haven't tried either approach.  If you do, please post your findings.

Thanks,
--Dean

 
Dean Brettle
Total Posts: 2015
Re: MultiFile does not display when placed in a hidden div
8/10/2009 12:53:48 AM
Fixed in 1.3.16.

 
Pages: 1   reply
a