2 Replies Latest reply on May 6, 2009 12:04 PM by Nick Thomson

    Running javascript after a reRender?

    Nick Thomson Newbie

      I have an a4j:region that by default is not rendered. Within this region is a javascript tag with some javascript I'd like to run when the region is rendered (example below, there are more items in there, but the cutdown test I have doesn't contain anything else).

      If I allow the region to be rendered by default the script is run, however when the region is not rendered by default but reRendered from a (for example) button, the script is apparently not run.

      Is there a better (correct?) way of doing this?

      <a4j:region id="testRegion" rendered="#{testBean.testRendered}">
       <script type="text/javascript">
       alert('test Region rendered');
       </script>
      </a4j:region>
      
      <a4j:commandButton value="test" action="#{testBean.toggleRendered()}" reRender="testRegion" />
      


      Thanks.