2 Replies Latest reply on Nov 21, 2008 10:48 AM by bartdp

    Disable component

    bartdp

      Hi all,


      I have posted this question on another forum, but didn't got an answer so far. And I also believe that the smart guys are sitting here :-)


      When I push a button, I want to disable a component from another form.
      This is the code in my bean:



      FacesContext context = FacesContext.getCurrentInstance();
      UIForm form = (UIForm)context.getViewRoot().findComponent("formid");
      UIInput comp=(UIInput)formHeader.findComponent("compid");
      comp.getAttributes().put("disabled", Boolean.TRUE);
      
      



      If I debug, I see that the component is set to disabled true. But nothing happens on the screen.
      How can I solve this problem?


      Thx Fons

        • 1. Re: Disable component
          perez83

          you can make this : with jsut a boolean variable



          @Stateful
          @Name("mysession")
          public class Mysession implements MysessionInt{
          
          
          disinput1=false
          
          //getter and setter
          
          //in your action or actionlistner
          
          public void myaction()
          {
          
          disinput1=true;
          } 
          }
          


          in your inputtext



          <h:inputText id="inp"  disabled="#{mysession.disinput1}"/>




          • 2. Re: Disable component
            bartdp

            So I was right about the smart guys ...


            Why am I always looking for a difficult solution while it can be so easy????


            Thanks BAF