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

  • Home
  • SEARCH
  • 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 3219916
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:42:05+00:00 2026-05-17T15:42:05+00:00

I’m developing a Java EE application (JSF2 + richfaces 3.3.3 + facelets). I want

  • 0

I’m developing a Java EE application (JSF2 + richfaces 3.3.3 + facelets).

I want to disable my h:selectOneMenu when loading my page, and when it finishes loading (using the function onload()), I want to re-enable my component.
I have something like this:

<ui:define name="infosHead">
     <script type="text/javascript">
        window.onload = function() {
          document.getElementById("forme1_myform:valueCh").disabled = false;
          alert("here");
        }
     </script>
</ui:define>
<ui:define name="infosBody">
   <h:form id="forme1_myform" target="_blank">
    <h:selectOneMenu id="valueCh" value="#{mybean.value}" disabled="true" >
      <f:selectItems value="#{mybean.values}" />
         <a4j:support event="onchange"
              ajaxSingle="true"
              limitToList="true"                      
              reRender="id1,id2,...."
              ignoreDupResponses="true"
              action="#{mybean.actionme}"
              oncomplete="getId();"/>
         </h:selectOneMenu>
   </h:form>
</ui:define>

this is working fine.
But my bean is getting nothing (mybean.value == null).

It’s like he thinks that the component is still disabled.

how can I make this works ?

  • 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-17T15:42:06+00:00Added an answer on May 17, 2026 at 3:42 pm

    I found this solution.

    <ui:define name="infosHead">
         <script type="text/javascript">
            window.onload = function() {
              updateName(false); // sets 'disabled' from true to false
            }
         </script>
    </ui:define>
    <ui:define name="infosBody">
       <h:form id="forme1_myform" target="_blank">
        <h:selectOneMenu id="valueCh" value="#{mybean.value}" disabled="#{mybean.render}" >
          <f:selectItems value="#{mybean.values}" />
             <a4j:support event="onchange"
                  ajaxSingle="true"
                  limitToList="true"                      
                  reRender="id1,id2,...."
                  ignoreDupResponses="true"
                  action="#{mybean.actionme}"
                  oncomplete="getId();"/>
             </h:selectOneMenu>
       </h:form>
        <a4j:form>
            <!-- this is where it's going to reRender my component -->
            <a4j:jsFunction name="updateName" reRender="valueCh">
                <a4j:actionparam name="param1" assignTo="#{mybean.render}"  />
            </a4j:jsFunction>
        </a4j:form>
    </ui:define>
    

    and this is the content of mybean:

    public class MyBean implements Serializable {
    
        private List<SelectItem> values;
        private String value;
        private Boolean render = true; // the page loads with element disabled
    
        public void actionme(){...}
        //getters & setters
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

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.