2 Replies Latest reply on Nov 24, 2010 5:20 PM by Derek MacDonald

    Multiple <a4j:support event="onclick"> on <h:selectBooleanCheckbox>

    Derek MacDonald Newbie

      I have a checkbox that triggers and AJAX call to refresh an <a4j:outputPanel> in the view to display required text inputs if the checkbox is selected. I also wish to perform an inplace AJAX save if the backing bean has already been persisted. Since action="" must be a method definition, I can't do:



      {code:xml}<a4j:support action="{mouselinePhenotypeHome.id > 0 ? mouselinePage.save : null}" ... />{code}


      So instead I have two <a4j:support> tags with rendered conditionals to make sure the correct one is used in the view. I've ensured the rendered="" value between the two are always mutually exclusive. But only the first <a4j:support> is ever recognized by Seam (the second isn't added to the component tree even if the rendered attribute is true). Swapping the order of the two, the former second <a4j:support> (now the first) is only used instead (if rendered="true"). I've tried using disabled="" instead of rendered="" (using the opposite boolean value) but then the reRender isn't called either.




      <h:selectBooleanCheckbox value="#{mouselinePhenotypeHome.instance.isLethal}">
           <a4j:support reRender="isLethalDetails" event="onclick" ajaxSingle="true" rendered="#{empty mouselinePhenotypeHome.id or mouselinePhenotypeHome.id eq 0}" />
           <a4j:support reRender="isLethalDetails" event="onclick" ajaxSingle="true" rendered="#{mouselinePhenotypeHome.id > 0}" action="#{mouselinePage.save}" />
      <a4j:outputPanel id="isLethalDetails">
           <s:decorate template="/layout/display.xhtml" rendered="#{mouselinePhenotypeHome.instance.isLethal}">           ....


      Is there a limit to only one onclick "signature" nested within a component? Why is the second event definition excluded from the component tree when its rendered attribute evaluates to true?