5 Replies Latest reply on Mar 16, 2010 9:33 AM by Rand Asin

    How to render dynamic javascript in tabPanel?

    Rand Asin Novice

      My page has a tabPanel and the content of the first tab is going to be HTML code entered by User.  So I use a outputText with escape=false to print HTML code loaded in the backing bean.  The problem I am having is that if the HTML code contains <script> tag, then tabPanel fails to render the scripts.  See example below.

       

      <rich:tabPanel switchType="ajax">
                                    <rich:tab label="First">
                                         <t:outputText value="<script src='http://www.gmodules.com/ig/ifr?url=http://bejeweledg.googlecode.com/svn/trunk/bejeweled.xml&amp;synd=open&amp;w=320&amp;h=270&amp;title=Bejeweled&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js'></script>" escape="false"></t:outputText>
                                    </rich:tab>
                                    <rich:tab label="Second">
                                         <t:outputText value="Here is tab #1"></t:outputText>
                                    </rich:tab>                              
                               </rich:tabPanel>
      

       

      In this example, First tab renders a Bejeweled Google Gadget.  When I first come to the page, the gadget is rendered correctly because First tab is already selected, but after clicking Second tab and back to First tab, the gadget is now missing.  I take it has something to do with region updated by Ajax, but I am not sure what to do.  Any thoughts would be greatly appreciated.  Thanks.