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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:40:11+00:00 2026-06-14T12:40:11+00:00

I have the following JSF 2 code: <p:selectOneMenu id=dropdown value=#{data.selection} required=true converter=selectOneMenuConverter> <f:selectItem itemLabel=Select

  • 0

I have the following JSF 2 code:

    <p:selectOneMenu id="dropdown" value="#{data.selection}" required="true" converter="selectOneMenuConverter">
            <f:selectItem itemLabel="Select one..." itemValue="" noSelectionOption="true" />
            <f:selectItems value="#{data.entries}" var="entry" itemLabel="#{entry.name}" itemValue="#{entry}" />
            <p:ajax update="display" event="change" />
    </p:selectOneMenu>

    <h:panelGroup id="display">
            <h:outputText value="#{data.selection}" />
    </h:panelGroup>

Everything works as expected when I choose a value from the dropdown.
When the user “deselects” an entry by choosing “Select One”, JSF complains that this is not possible because the selectonemenu is required.

The problem comes from there that the p:ajax makes a partial submit that triggers validation. Immediate=true does also not work because in case the immediate happens on an input field (like selectonemenu is) a validation is performed.
The validation shall only happen when the user presses the “go on” button on the bottom of the page (not shown in code)

Further the given converter converts the Strings to Objects and for the default value it returns null (that’s also the expected value within the domain for “no selection”).

So my question is what I must do to fulfill my case.
For my this is a standard case and I cannot imagine that there is no solution for this.

Any ideas?

Best regards,
Florian

  • 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-14T12:40:13+00:00Added an answer on June 14, 2026 at 12:40 pm

    The validation shall only happen when the user presses the “go on” button on the bottom of the page (not shown in code)

    Then just tell the dropdown’s required attribute to do exactly that instead of hardcoding a true.

    <h:form id="form">
        <p:selectOneMenu ... required="#{not empty param['form:go']}">
            ...
        </p:selectOneMenu>
    
        ...
    
        <p:commandButton id="go" ... />
    </h:form>
    

    The #{not empty param['form:go']} will only evaluate true when the form submit has actually been taken place by the submit button which has the client ID form:go in the particular example. If you don’t like hardcoding client IDs either, then reference it as follows:

    <h:form>
        <p:selectOneMenu ... required="#{not empty param[go.clientId]}">
            ...
        </p:selectOneMenu>
    
        ...
    
        <p:commandButton binding="#{go}" ... />
    </h:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have follow following code in my JSF application <t:dataList id=slider-one value=#{MyBean.banners} var=ofr layout=simple
I have the following code in JSF-2 Mojarra 2.0.8 running on Tomcat 7 <h:panelGrid
I'm using Glassfish 3.1.1 and JSF 2.0: I have the following code: public String
I have the following JSF code (stripped down for the sake of sanity): <!DOCTYPE
I have the following code: JSF Managed Bean: @ManagedBean(name = purchaseView) @ViewScoped public class
I have following line of code for jsp tag <input name=UnicodeVirtualKey class=btn type=button value=&#x0A85;
I have the following code inside a method invoked by a jsf <h:commandButton>. It
I have a following code: <div id=mws-navigation> <ul> <li><p:commandLink value=#{contentMB.msg.welcome_title.value} actionListener=#{cleanUpMB.alChangeArea} styleClass=mws-i-24 i-home action=#{welcomeMB.aLoadDashboard}
In JSF, I have this: <h:selectManyListbox id=createAccountBasicInfo_select_Types styleClass=selectManyCheckbox value=#{party.roles} size=6 converter=persistenceObjectToStringTwoWayConverter> <f:selectItems value=#{accTypes.selectItems} />
I have this new problem. I have the following code in JSF 2.0 with

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.