0 Replies Latest reply on Aug 30, 2011 5:30 AM by gpioli

    Execute wiring on event

    gpioli

      Hi everybody!


      I doing some experiments with seam 2.2.2 Final.
      I have used seam generate-entities starting from two very simple tables, the entities are Parent:


      @Entity
      @Table(name = "Parent", catalog = "seam_fk_test_001")
      public class Parent implements java.io.Serializable {
      
           private Integer idParent;private String parentDesc;
           private Set<Child> childs = new HashSet<Child>(0);
           [...]
      }



      and Child:


      @Entity
      @Table(name = "Child", catalog = "seam_fk_test_001")
      public class Child implements java.io.Serializable {
      
           private Integer idChild;
           private Parent parent;
           private String childDesc;
              [...]
      }



      I would like to add to childEdit.xhtml the capability of choosing the Parent using a selectOneMenu, here is my code:


           <s:decorate id="idParentField" template="/layout/edit.xhtml">
                <ui:define name="label">Parent</ui:define>
                <h:selectOneMenu id="idParent"
                     required="true"
                     disabled="#{childHome.managed}"
                     value="#{childHome.instance.parent}">
                     <!-- valueChangeListener="#{childHome.prewire}" -->
                     <s:selectItems value="#{parentList.resultList}" var="_p" label="#{_p.parentDesc}" noSelectionLabel="Select parent..."/>
                     <s:convertEntity/>
                     <!-- <a:support action="#{childHome.prewire}" event="onblur" reRender="child" bypassUpdates="true" /> -->
                </h:selectOneMenu>
           </s:decorate>



      I would not to modify the behaviour of the generated button and let it disable until all required field and dependency are not satisfied:


                  <h:commandButton id="save"
                                value="Save"
                               action="#{childHome.persist}"
                             disabled="#{!childHome.wired}"
                             rendered="#{!childHome.managed}"/>
                             <!-- disabled="#{!childHome.wired}" -->
      




      So my question is how can i invoke the wire method from a jsf page? I have tried various approach but without any luck and I haven't been able to find any info on this subject.


      Thank you.


      GP