Clear FacesMessage on clicking FileUpload - jsf

I have a page to upload a file. If there is a message on the page previously due to success/failure of some operation, I want it to go away as soon as I click the button to Upload a file. But I saw that update only works after the file upload completes.

Assuming you are using PF8+ since you did not mention your version you can remove it with Jquery on Adding of file...
<p:fileUpload onAdd="$('.ui-messages').css('display','none');" ...
The above is shortened for brevity but basically hides the messages when you add a file.

Related

Problems calling SharePoint Document Library upload form with custom button

I'm trying to create a link (not actually a button, but styled as a button) that calls up the Upload.aspx for a document library but I'm running into issues once Upload.aspx loads. The main issue is that the Cancel button is non-functional. I can upload select a file and upload it (and this works), but if I were to have accidentally clicked on the initial link and want to navigate away without uploading, the Cancel button doesn't make the page go away.
Now I haven't been able to have Upload.aspx display as a dialogue box over the list page--it gets called as a full page (even though I have "Open forms in dialog" enabled). I'm wondering if that's what the Cancel button expecting. Any ideas? The link that is being called is:
/mySite/_layouts/15/Upload.aspx?List=%7B4982C5B5%2DCF88%2D497F%2DA48D%2D815D7A355F0A%7D&Source=https%3A%2F%2FmyServer%2Ecom%2FmySite%2FmyDocLibrary%2FForms%2FAllItems%2Easpx&isdlg=1"
Turns out it was the &isdlg=1 at the end of the URL that was causing the Cancel button to not work. I removed this from the URL and it works properly now.

NODE.JS: Submit form without page reload?

I have a form with action attribute and within: input text and submit. When the user presses submit, the information they provided will be used to send a text message using Twilio. My question is how do I do this without reloading the page or going to another a page? Instead, I would rather have a cool small animation that displays whether it sent successfully or not, with the page remaining the same.
Thank you for your help. Much appreciated!
I basically did what zeronone said with listener on submit event, but instead wrote "return false;" preventing the page reload. I then included ajax, and the rest of the code remained basically the same.

Prevent primefaces uploaded file from disappearing when it completes uploading

I would like to implement a multiple fileUpload.
I don't want the upload and the cancel buttons to be appearing on screen,so basically there are two ways for me to proceed.
First way : Hiding the Upload and the Cancel buttons via CSS.
I can hide them,the problem is that I can't trigger anymore the upload button,so files will never be uploaded.
In this case : is there a way to trigger the Upload button with a commandbutton ?
Second Way : adding auto="true" to the fileupload tag ,so the Upload and Cancel Buttons would disappear,but the problem with this way is that when the file is uploaded,it instantly disappears from screen,and the user can't no more click on the cancel icon next to the progress bar to cancel the upload.
So,in this case,is it possible to prevent the uploaded file from disappearing when the file is uploaded ?
I would like it to work like the google uploading file system when sending a mail , the user can choose to upload many files,but can still delete those if he chooses to (before sending the mail of course).
You can activate p:fileUpload's buttons from your own buttons like:
<p:commandButton value="My upload button" onclick="$('.ui-fileupload-upload').click(); return false;" />
The 3 buttons use the css classes
.ui-fileupload-choose
.ui-fileupload-cancel
.ui-fileupload-upload
Hide them with for example
.ui-fileupload-upload {
display: none;
}

Update view after using file upload

I am sure this is related to my question here
Null value for fileData:com.ibm.xsp.http.UploadedFile in dialog box?
Which I am still not 100% clear why the file upload control does not work directly in an extension pages dialog box.
But anyway I came up with my own solution using the file update control inside of a hidden panel. I need to set the button that uses the control to full update.
I have a button does an import of data. The button gets the file via a file upload control. This data is displayed in a view on the xpage.
The view is not being updated even though the Import button has Full Update. I am guessing that the full update actually get executed before the import actually completes?
Is there anyway to update my view after the import completes?
My understanding is that a File Upload requires a full refresh of the XPage to push the file up to the temporary folder on the server. At this point, the attachment is just stored in that temporary folder. It's not stored in the NSF. A subsequent function needs to be run to save that to a document.
Is your button doing the upload of the file to the temporary folder, or is it saving a Notes Document / directly accessing the temporary file and processing it via the back-end? If it's just performing the upload, the view won't upload.
The other thing I've come across is View Panels not immediately updating with new documents that have been created. In that scenario, a repeat control bound to NotesView.getDocumentsByKey() did immediately update.
I solved the issue by causing the button that uploads the file to display an extension pages dialog box. This dialog box has an OK button to close the message box but also refreshes the required part of the form.

add extra description field to file upload primefaces

I use the primesfaces p:fileUpload tag, witch works fine. But I need to be able to ad a description to the files I upload. How can I do this?
I added a textfield on my page and assigned it to a bean property. But how Can I update it when pressing the primefaces upload button? (The fileUpload is ajax, so not the entire form is submitted. I don't want to submit the whole form because I don't want validation errors when uploading files)
Or should I need to use another tag (other library)?
Roel

Resources