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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:26:23+00:00 2026-05-27T12:26:23+00:00

I have a form that has a field that needs to be rendered as

  • 0

I have a form that has a field that needs to be rendered as a read-only value when in edit mode and as a drop-down select list when in create mode.

The read-only field (used in edit mode) is rendered as plain text using <h:outputText>. In create mode, the field is rendered <h:selectOneListbox> that has a required attribute of “true”.

It seems to work as I expect most of the time, but occasionally I get a validation error when in edit mode (the select list box is not rendered) .

Here is the code snippet that has both fields defined with their rendered attributes set using the same boolean value (just one field negates the boolean to toggle).

<h:outputLabel id="lblBusinessArea" value="Business Area:" />
<h:panelGroup id="baGroup">
    <h:selectOneListbox id="businessAreaList" size="1"
            rendered="#{shiftDetailsController.canEditBusinessArea}" 
            converter="businessAreaConverter"
            value="#{shiftDetailsController.selectedBusinessArea}"
            label="Business Area"
            required="true">
        <f:selectItems id="businessAreaListItems" value="#{shiftDetailsController.businessAreas}" />
        <a4j:support id="businessAreaA4j" event="onchange"
            ajaxSingle="true" reRender="deploymentGroupList, positionPayGroupList, sapPremCodeList" />
    </h:selectOneListbox>
    <h:outputText id="businessAreaRO" 
         rendered="#{!shiftDetailsController.canEditBusinessArea}" 
         value="#{shiftDetailsController.selectedBusinessArea.busAreaDesc}" />
</h:panelGroup>

Below is a screen clipping showing the field (in edit mode) rendered as read only. The “save” button was clicked and I get a validation error message that the field is required.

  1. The value should be there in the backing bean because the value displayed is from the same object (shiftDetailsController.selectedBusinessArea). The output text uses the description field on the business area ojbect and the select field uses the whole object where the SelectItem has the description in the label.

field rendered as read-only with validation message appearing

Any idea how this could be occurring? I could set the required attribute using the same boolean value that determines the rendered state…so that it is only required when it is rendered…but since this problem is intermittent…I don’t know that will really help.

I also verified that no other components on the page inadvertently have a label value of “Business Area” (which is being used in the validation message) to mislead me in which component truly has a null value; this is the only one that has the label of “Business Area”.

  • 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-27T12:26:24+00:00Added an answer on May 27, 2026 at 12:26 pm

    I figured out what was happening with this issue.

    Prior to submitting the form and receiving the validation error. I was making a change that caused the flag controlling the two components’ visibility to be reversed.

    rendered="#{shiftDetailsController.canEditBusinessArea}"
    

    In other words, what I was doing on the form was causing the canEditBusinessArea to change values. But, I was not re-rendering the panel group (“baGroup”) to cause the UI to reflect the update.

    Thus, when my form was submitted the component during the validation phase was seen as being required…triggering the validation to happen. As soon as I added “baGroup” to the reRender of the action that was flipping the edit business area flag, the UI began reflecting the update and the submitted form had the value.

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

Sidebar

Related Questions

i have a form that has a multiple select drop down. a user can
I have a form that needs to be validated only after it has been
I have a form that has a field (Field A) that needs to be
I have a field in a CCK node form that is hidden, and has
I have a form that has a field pulled from the database as a
On my page I have a drop-down select box, with a default value of
I have a form page that has an inputText field that accepts a date.
I have a modelform which has one field that is a ForeignKey value to
I have a form that has a group of 3 text_fields. I need two
I have a form that has multiple fields, and for testing purposes is there

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.