2 Replies Latest reply on Dec 19, 2011 12:28 AM by Lu Han

    Use prototype js library with RF 4

    jclaus Newbie

      Hi all,

       

      I am trying to use javascript prototype library with RichFaces 4.

       

      The problem I found is that when I include the prototype library, component richfaces jscode fails, i.e. the generated by <rich:messages/>. The richfaces js code that fails is the following, because $(document).ready function is not recognized:

      ...

      $(document).ready(function() {

      18new RichFaces.ui.Message("j_id1515011988_5a4d3fde:j_id1515011988_5a4d3ffc",{"isMessages":true} )

      19});

      ...

       

      As I could see, it seems that richfaces js code use jQuery using $(...) instead of jQuery(...) or some sort of variable like var $j = jQuery.noConflict();

       

      As solution, I tried to disable disable $(...) prototype's use, but I couldn't find how, and disabling it for jQuery it is not a valid solution because richfaces continues generating $(...) syntaxis for jQuery.

       

      Does anyone know how to fix it?

       

      Thank you and best regards

       

      Sample page:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

              xmlns:h="http://java.sun.com/jsf/html"

              xmlns:rich="http://richfaces.org/rich">

       

          <h:head>

          </h:head>

       

          <h:body>

                  <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>

                    <h:form>

                      <rich:messages/>

                      <h:outputText value="Hello"/>

                    </h:form>

          </h:body>

       

      </html>