fileUpload and ajaxStatus

UI Components for JSF
Post Reply
ahmetcemrek
Posts: 8
Joined: 14 Aug 2011, 20:59

28 Nov 2011, 09:13

Hi,

I have the following code, ajax status dialog, and panelgrid in which there is a fileupload component.
In this code snippet when i upload the file the ajaxStatus dialog shows up but newer closes, besides the file is successfully uploaded.
(I think with file upload there is no need to show ajax status due to the integrated progressbar in fileupload component in advanced mode)

I figured it out that the problamatic part is update="wrapper" attribute. If i delete this attribute, everything is ok, however i need to update the component.

<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>

<p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false">
<p:graphicImage value="/images/ajaxloadingbar.gif" />
</p:dialog>

<h:panelGrid columns="1" id="wrapper">

<h:form id="imageUploadForm" rendered="#{fileUploadBean.uploadedImageUrl == null}" >
<p:fileUpload fileUploadListener="#{fileUploadBean.handleFileUpload}"
mode="advanced"
update="wrapper"
auto="true"
sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
</h:form>

<h:form rendered="#{fileUploadBean.uploadedImageUrl != null}">
<p:imageCropper value="#{fileUploadBean.croppedImage}"
image="#{fileUploadBean.uploadedImageUrl}"
initialCoords="225,75,300,125" aspectRatio="1" backgroundOpacity="0.5" />
</h:form>

</h:panelGrid>

Thanks...
primefaces-3.1-SNAPSHOT on Mojarra-2.1.4

glister
Posts: 64
Joined: 19 Jan 2010, 11:39

01 Dec 2011, 16:08

Hey ahmetcemrek,

i have exactly the same problem, and would like to know whats wrong here.

*push* :|
PrimeFaces version:
using Primefaces 5.2.11 on a Glassfish v4.1 Server

Additional Libraries:
using PrimeFaces Extensions 3.2
using OmniFaces 2.1

Additional Books:
PrimeFaces Cookbook

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

01 Dec 2011, 16:27

AFAIK FileUpload does not upload with ajax. Its using an own iframe or so.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

kwutzke
Posts: 201
Joined: 20 Jul 2012, 21:35

25 Oct 2012, 09:29

Reviving an old post...

I had the same problem. The p:fileUpload doesn't seem to close such a dialog per se (while I think it should).

The fix that worked for me is when using update="..." you also need

Code: Select all

oncomplete="statusDialog.hide();"
along with widgetVar="statusDialog" on the status dialog, of course.

Karsten
PrimeFaces 13, Mojarra 4.0, WildFly 31, Jakarta 10 + PrimeReact

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

25 Oct 2012, 09:40

kwutzke wrote:Reviving an old post...

I had the same problem. The p:fileUpload doesn't seem to close such a dialog per se (while I think it should).

The fix that worked for me is when using update="..." you also need

Code: Select all

oncomplete="statusDialog.hide();"
along with widgetVar="statusDialog" on the status dialog, of course.

Karsten
Don't indulge in Thread Necromancy.
If you have a question or problem that needs solving OR you want to share some startling revelation with us, start a new Thread. If you need to provide context, link the old thread.

The forum rules can be reached by following the link at the end of this post, read them.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 44 guests