Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9180739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:07:31+00:00 2026-06-17T18:07:31+00:00

Having 2 forms, need only 1 submit button: <h:form> <h:panelGrid columns=2> <h:outputText value=#{msgs.shortDescription}/> <p:inputText

  • 0

Having 2 forms, need only 1 submit button:

<h:form>
<h:panelGrid columns="2">
<h:outputText value="#{msgs.shortDescription}"/>
<p:inputText value="#{fileBean.shortDescription}" required="true"/>
<h:outputText value="#{msgs.longDescription}"/>
<p:inputTextarea value="#{fileBean.longDescription}" required="true"/>

<h:selectOneMenu value="#{enumRegistration.selectedRegion}">
<f:selectItems value="#{enumRegistration.regionList}"/>
<f:ajax listener="#{enumRegistration.selectCity}" render="citiesmenu"/>
</h:selectOneMenu>

<h:commandButton value="Submit" action="#{fileBean.updateAd}"/>
</h:panelGrid>
</h:form>

<h:form enctype="multipart/form-data">
<p:fileUpload value="#{fileBean.file}" mode="advanced"
fileUploadListener="#{fileBean.handleFileUpload}"
required="true" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
requiredMessage="You must upload a file"/>
<p:commandButton value="Submit" ajax="false"/>
</h:form>

How to have only 1 submit button?

One option would be to enclose both within one form… Is it really the best option to have multipart/form-data on a regular form too?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:07:32+00:00Added an answer on June 17, 2026 at 6:07 pm

    Put all the fields in just a single form. It won’t break anything, and having two forms is bad due to:

    1) The browser expects that after submitting the form, it will receive the data for loading a new page (in the current frame or in another). Making him send the second form after the first may result in errors.

    2) JSF expects that the POST means that a new page/view is ready. Following POSTs from the same page might be ignored.

    3) 1 & 2 are not true if you use AJAX. That said, if you want to send both forms at the same time there is no sense doing it with AJAX. And, if you still do, you will have a file uploaded in a request and a form uploaded in the other, and you will have to match one with the other in the server, somehow.

    4) Putting all together is well tested, tried and understood. There are thousands of pages explaining how to configure the filters, access data, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really need help on this one. I am having a simple login form
document.forms[regform][fname].value; In java script i get the value of input having name(fname) which is
I am having a php form, and a lot of markup, so i need
Having two forms, each in it's own jQuery UI tab, how can I post
I am having two forms, 1st is form_1 and 2nd is form_2. form_1 containing
I am having difficulties with forms, specifically ModelMultipleChoiceField. I've pieced together this code from
I am new to Windows forms and having an issue handling all the user
I'm having problem when running my Windows Forms program. In the program, I have
I'm having a problem with nested model forms that contain radio buttons, when I
I am having problems with django forms and image uploads. I have googled, read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.