2 Replies Latest reply on Nov 25, 2008 1:58 PM by Flavio Henrique

    modalPanel with dynamic backBean as parameter

    Flavio Henrique Newbie

      Sorry, I posted this message in Ajax4JSF Users by mistake. So I'm posting here...
      Thanx.

      "Hwoarang" wrote:
      Hi there!
      I have a modalPanel that show a r:dataTable. The user should select one record from table and update two fields on parent form.

      My modal's code is in the template.jspx (I'm using facelets).

      It works, but as the modalPanel will be invoked from different pages (different backBeans), I wish to pass the backBean's name to modalPanel and use it to set the fields...

      How can I do that ?

      Here's the code:

      Let's say on 'Page1.jspx':
      <h:inputText id="idPerson" value="#{Bean1.idPerson}" />
      <a4j:commandButton
       value="..."
       reRender="mymodal"
       oncomplete="Richfaces.showModalPanel('mymodal', {backBean: 'Bean1'}); return false;">
      


      Now on 'Page2.jspx':
      <h:inputText id="idPerson" value="#{Bean2.idPerson}" />
      <a4j:commandButton
       value="..."
       reRender="mymodal"
       oncomplete="Richfaces.showModalPanel('mymodal', {backBean: 'Bean2'}); return false;">
      


      Note that when I call the modalPanel I passed two different parameters (the backBean's name).

      My modalPanel's code:

      <r:modalPanel id="mymodal">
       ...
       <a4j:commandLink
       reRender="idPerson"
       oncomplete="Richfaces.hideModalPanel('mymodal');">
       <a4j:actionparam
       name="paramId"
       value="#{item.id}"
       assignTo="#{HowToPutTheParamHere.idPerson}"/>
       </a4j:commandLink>
      </r:modalPanel>
      


      I think the idea was passed: I want to assign some value to the same field, but in different backingBeans, that was passed to modalPanel as parameter.

      Maybe setting only the fields from parent form (like opener in javascript)


      Any idea ?

      Thank you in advance!