Primefaces file upload changes browser tab title to file name - file-upload

If I upload a file with primefaces dialog the browser tab title is changed form the application name to the file name after the upload. This occurs with Firefox (41.0.2) and Chrome (46.0.2490.80). With Internet Explorer it does not occur. I am using Mojarra 2.2.12 and Primefaces 5.3. How can I suppress this?
<p:fileUpload id="docUploadId" widgetVar="docUploadWidgetVar" fileUploadListener="#{uploadDocumentBL.handleDocumentUpload}" mode="advanced"
dragDropSupport="true" multiple="true" fileLimit="#{uploadDocumentBL.fileCountUploadLimit}" sequential="true"
sizeLimit="#{uploadDocumentBL.fileSizeUploadLimitForOneFile}" cancelLabel="#{msgs['label.button.fileUpload.resetButton']}"
uploadLabel="#{msgs['label.button.fileUpload.uploadButton']}" label="#{msgs['label.button.fileUpload.chooseButton']}"
fileLimitMessage="#{msgs.getTextWithParams('msg.error.validation.upload.tooMuchFiles', uploadDocumentBL.fileCountUploadLimit)}"
invalidSizeMessage="#{uploadDocumentBL.getMaxFileSizeExceededValidationMessage()}" styleClass="uploadDocument" update="#this">
<h:panelGroup id="dropZoneTextId" styleClass="dropZoneTextDiv" layout="block">
<h:outputText value="#{msgs['label.documentUpload.fileDropZone']}" styleClass="dropZoneText" />
</h:panelGroup>
</p:fileUpload>

Related

How can I hide name of file uploaded using <p:fileUpload/>

Hello after upload an image using p:fileUpload, it shows the name of the file like this Screenshot presents.
My issue is how can I hide the name BillGates.JPG after clicking on Choose Background.
--> So, I want to have after clicking on Choose Background and before clicking on Register this NewScreenchot instead of the first one.
Below is the file upload component to choose an image:
<p:fileUpload id="bck"
value="#{connectedUserBean.file}"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
label="Choose Background"
mode="simple"
skinSimple="true"
auto="true"/>
The button to save it is:
<p:commandButton value="Register"
update="ee" ajax="false"
style="width: 100px;height: 30px;font-size: 13px;background-color: #ff66d9;"
actionListener="#{connectedUserBean.upload}"/>
Have you please any idea about solving this. Thanks a lot.
Just add this to your css file:
.ui-fileupload-filename {
display: none;
}

map is not refreshing using gmaps4jsf

I am using gmaps4jsf jar file for getting dynamic marker on google map but once i click on submit button then getting whole data on web page, evem map also with dynamic marker but map marker is coming after refresh the page.
jsf code:
<m:map id="map" width="650px" height="450px" latitude="#{map.latitude}" longitude="#{map.longitude}" enableScrollWheelZoom="true" zoom="9">
<m:marker latitude="#{point.latitude}" longitude="#{point.longitude}" >
<m:htmlInformationWindow htmlText="Click me!" />
</m:marker>
</m:map>
<p:column>
<p:commandButton value="Display" action="#{map.display}" update="form"/>
</p:column>
jsf component is refreshing fine only problem with google map..
You should use partiallyTriggered="true" for refresh the google map. as you said you are using gmaps4jsf jar so it will help and i'm updating your code so you can find here
<m:map id="map" partiallyTriggered="true" width="650px" height="450px" latitude="#{map.latitude}" longitude="#{map.longitude}" enableScrollWheelZoom="true" zoom="9">
<m:marker latitude="#{point.latitude}" longitude="#{point.longitude}" >
<m:htmlInformationWindow htmlText="Click me!" />
</m:marker>
</m:map>

Is there an easy way to make the fileupload work with IE11 without updating zk

In IE11 file upload button of ZK is not working.
I got few replies, It says after updating ZK it will fix the problem.
But we can't update ZK, So in this scenario is there any way to work out this problem any how.
If you can't upgrade ZK then you can try to "downgrade" the IE using "X-UA-Compatible" either as meta-tag or as a response header
here an example using the meta tag:
<?meta http-equiv="X-UA-Compatible" content="IE=10" ?>
<zk>
<fileupload label="upload" onUpload="alert(event.getMedia().getName())"/>
</zk>
and what it looks like in the browser (in the IE dev tools F12 you can check if the meta tag had an effect, you'll see that IE falls back to version 10):
http://screencast.com/t/ftheLA9Ud8
Finally I got the Solution.
AS IE 11 having problem to attach event for listening to open File chooser.
You just manually add the listener.
<button id="browsebtn" upload="true,maxsize=-1" visible="true" sclass="text">
<attribute w:name="doMouseDown_">
function (evt) {
}
</attribute>
</button>
Its simple and weird, However what I found is make the parent component as draggable="true"
<row draggable="true">
<div style="text-align : right;">
<label value="Image File:" />
</div>
<fileupload id="fileUpload" label="Upload" tooltiptext="Click to upload image file."/>
</row>
Now suddenly you will see your fileupload button in ZK started working correctly for IE11 as well.

Primefaces p:fileUpload not working [duplicate]

This question already has an answer here:
Manually adding / loading jQuery with PrimeFaces results in Uncaught TypeErrors
(1 answer)
Closed 7 years ago.
Im using Primefaces4.0 with JSF2.0, i know some basics of Primefaces.
For me p:fileUpload is not working, it was working before. don't know what happend
when i select any file from the file chooser no file populated in file pan of p:fileUpload.
here is my code:
<p:panel style="font-size:15px;" header="Upload">
<p:fileUpload fileUploadListener="#{addAgentxls.handleFileUpload}" mode="advanced" dragDropSupport="true"
update="messages status" sizeLimit="100000" style="font-size:12px;" />
<p:growl id="messages" showDetail="true"/>
<p:outputLabel id="status" style="font-size:13px;" value="#{addAgentxls.status }"/>
</p:panel>
class file:
#ManagedBean(name = "addAgentxls", eager = true)
#SessionScoped
public class AddAgentUsingXLS {
public AddAgentUsingXLS(){
}
public void handleFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
web.xml:
<!-- File Uploading Constraints -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
i also see This done nothing for me
there is an error on google chrome browser
Uncaught TypeError: Object [object Object] has no method 'fileupload'
fileupload.js.xhtml?ln=primefaces&v=4.0:1
does it worth anything?
Solved.. ! i was using newer version of jQuery.js which was conflicting with Primefaces
please consider the suggestion on the following stack overflow link.
In JavaScript can I make a "click" event fire programmatically for a file input element?
Same issue. jQuery(".primeFacesHiddenAwayButton type=['file']").click() worked fine on IE as well as firefox ( My firefox is not the latest due to Selenium driver constraints). In any case, in chrome the JS button simply did not work. This is, apparently, a security feature built into the browser. You can try the suggestion on the provided link.

embed PDF content in xulrunner

On xulrunner 1.9.2 I could put the Adobe Reader plugin into /plugins of my xulrunner application and load content with:
<vbox minwidth="200">
<html xmlns = "http://www.w3.org/1999/xhtml" >
<div id="htmlDiv">
<embed
id = "pdfObject"
type = "application/pdf"
src = "chrome://manuals/content/test.pdf#toolbar=1&navpanes=1&scrollbar=1&page=1&view=FitH"
height = "850px"
width = "1100px"
/>
</div>
</html>
</vbox>
I am moving now to xulrunner 17.0.1 and I couldn't get it to work - the Adobe Reader gives an error witin its own popup.
I checked the versions to what is in the current Firefox installation and it is correct. I also deleted pluginsreg.dat from the application profile - no success.
Any ideas on how to get back that content into xulrunner based apps would be great.
xuldev
Never mind - a chrome path was missing a trailing slash in the chrome.manifest ;)
Paul