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 7169577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:01:27+00:00 2026-05-28T15:01:27+00:00

I looked at other similar posts, but none that helped. Here is my code:

  • 0

I looked at other similar posts, but none that helped. Here is my code:

<script  type="text/javascript">
function submit1()
{
document.forms["form"].submit();
}
</script>

<form name="form">
    <h:selectOneMenu value="#{bean.categorySelected}" onchange="submit1()"
valueChangeListener="#{bean.changeCategory}">
    <f:selectItem itemLabel="Select a Category" itemValue="null" />
    <f:selectItems value="#{bean.items}" />
</h:selectOneMenu>
</form>

When I select from the drop down, it only reloads the component. This means bean.getItems is called, but not the value or valueChangeListener, My logs indicate that it only went through phase phase 1 and 6. If I remember correctly, phase 2-5 doesn’t fire unless the form is submitted. What am I doing wrong?

  • 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-05-28T15:01:29+00:00Added an answer on May 28, 2026 at 3:01 pm

    You need a fullworthy JSF <h:form> component instead of a plain HTML <form> element. A plain HTML <form> element without any method and action attribute fires on submit by default a GET request on the current URL. That confirms exactly the behaviour you’re seeing. It’s like as you’re just refreshing the currently requested page by F5.

    So, fix it as follows:

    <h:form>
        <h:selectOneMenu value="#{bean.categorySelected}" onchange="this.form.submit()" valueChangeListener="#{bean.changeCategory}">
            <f:selectItem itemLabel="Select a Category" itemValue="null" />
            <f:selectItems value="#{bean.items}" />
        </h:selectOneMenu>
    </h:form>
    

    (note that the additional JS function is unnecessary)

    The <h:form> will generate a <form method="post"> along with at least two JSF-specific hidden input fields identifying the current form and the view state (check the difference in the generated HTML output after you fixed the JSF code). The combination of the POST request and the two hidden fields enables JSF to know what view it has to deal with and what form it has to process and what listeners and action it has to invoke.

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

Sidebar

Related Questions

I've looked at other questions on Stack Overflow related to this question, but none
(I've looked at many other similar posts on SO and have unfortunately not been
there were a few question similar to mine on the stack but none that
Looked at some other similar answers on stack overflow, but no relevant answer was
I've looked at a number of other similar questions, but the methods given seem
I've looked through similar questions but I'm still a little perplexed about something that
I've looked at other definitions and explanations and none of them satisfy me. I
I looked through the other posts and bug reports and couldn't figure out what's
I've looked at several other SGen-related questions on here and either their answers don't
I'm trying to learn XPath. I looked at the other contains() examples around here,

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.