1 Reply Latest reply on Oct 29, 2010 5:46 AM by Leo van den berg

    Can we toggle a modalPanel from action?

    Tina Ng Newbie

      Hi,
      I have a scenario like this, but I don't know how to do ... So any idea is welcome!


      A materiel can be a gca or a parc (i.e i have two tables gca, parc). And if a materiel is in gca, it is not in parc.
      I have a screen to search materiel or create, by giving a number registration.


      If we give a number registration (ask for creation) that exists in gca, we don't allow user to create. This is easy.


      If we give a number registration (ask for creation) that exists in parc, we need to display a message to say


      "it already exists in parc. Do you want to replace it? [yes] [no]"





      In this case, we can click on yes or no and do action according to the choice of user.


      And that's the reason why I'm thinking of a modalPanel (defined in xhtml for sure) but do we have to control (show or not) from backing bean or do we have another way to do show or hide in xhtml?


      Thanks for your time!
      Tina

        • 1. Re: Can we toggle a modalPanel from action?
          Leo van den berg Master

          Hi,


          create a button which depends on the value in the table. So let's say if  gca buttonone and if parc buttontwo. In the rendered attribute you put this check. Something like:




          yourObject.class.simpleName == 'WHATEVER' 
          
          or something more sofisticated in the backing bean.
          
          public boolean checkPARC(){
          if (yourObject instanceof PARC) return true;
          else return false;
          } 




          Each button is rendered only when the object is of a specific class, so you can ad whatever behaviour you want.


          Hopefully this helps a bit.


          Leo