File Upload and Submit

UI Components for JSF
Post Reply
sudhik.sk@gmail.com
Posts: 5
Joined: 08 Jun 2017, 20:29

16 Aug 2017, 23:36

Hello,

I am completely new to Primefaces (even JSF for that matter) and was trying to build one simple webform to send an email.

I have almost finished it but I'm trying to use p:commandButton and p:fileUpload in the same form but the form doesn't gets submitted.

Instead I use h:commandButton and it works perfectly fine. But with this, I don't know if I can validate client so easily.

Please help. Thanks in advance.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

17 Aug 2017, 09:25

The difference between an p and h commandButton is that the former is by default ajax enabled. Try with an ajax enabled h:commandButton. Does that fail to? And please read the static topic, the one with PLEASE, PLEASE in it. Version info and mcve

sudhik.sk@gmail.com
Posts: 5
Joined: 08 Jun 2017, 20:29

17 Aug 2017, 18:41

Thanks,

Primefaces button works when set to ajax="false". I'll try to validate client now.

I used ajax with h:commandButton and it works as well. Just used below snippet of code and I got email twice

<h:commandButton value="Send Email" action="#{indexView.submitForm}">
<f:ajax execute="@form" listener="#{indexView.submitForm()}" />
</h:commandButton>

sudhik.sk@gmail.com
Posts: 5
Joined: 08 Jun 2017, 20:29

21 Aug 2017, 21:04

kukeltje wrote:
17 Aug 2017, 09:25
The difference between an p and h commandButton is that the former is by default ajax enabled. Try with an ajax enabled h:commandButton. Does that fail to? And please read the static topic, the one with PLEASE, PLEASE in it. Version info and mcve
Thanks again!

So, do we know how to get ajax working with file upload. I'm now trying to use p:commandLink as well and as submit, it doesn't work with ajax = true

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests