Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-8608

rich:effect name does not properly create the JS function to be called

    Details

    • Similar Issues:
      Show 10 results 

      Description

      rich:effect name does not properly create the JS function..

      Consider your documentation example:

      <!-- invoking by JavaScript -->
      <div id="contentDiv">...</div>
      <input type="button" onclick="hideDiv(

      {duration:0.7}

      )" value="Hide" />
      <input type="button" onclick="showDiv()" value="Show" />
      <rich:effect name="hideDiv" for="contentDiv" type="Fade" />
      <rich:effect name="showDiv" for="contentDiv" type="Appear" />

      it worked on the older version but in 3.3.3 so I must downgrade :|

      This is my browser complaint:

      Error: Effect[A.type] is not a constructor
      Source File: http://localhost/a4j/g/3_3_3.Final/org/richfaces/ui.pack.js
      Line: 15201

        Gliffy Diagrams

        1. processEffect.js.patch
          0.4 kB
          Marek Będkowski
        2. richFacesRegister.xhtml
          2 kB
          Tomas Cerny

          Issue Links

            Activity

            Show
            nbelaevski Nick Belaevski added a comment - Introduced by http://fisheye.jboss.org/viewrep/RichFaces/branches/community/3.3.X/ui/effect/src/main/resources/org/richfaces/renderkit/html/script/processEffect.js?r=14940 in processEffect.js file.
            Hide
            enda Tomas Cerny added a comment - - edited

            Here is a workaround:

            go to file ui.pack.js and replace variable "params" for "myparams" in the part related to processEffect.js


            if(!Richfaces.effect){Richfaces.effect={}
            }Richfaces.effect.create=function(options){if(!options){options={}
            }var myparams=options.params||{};
            options.params=null;
            var attachObj;
            var targetObj;
            var targetId=options.targetId;
            var attachId=options.attachId;
            if(options.attachObj){try

            {attachObj=eval(options.attachObj) }

            catch(e){}if(typeof attachObj=="object"){attachId=attachObj
            }}if(options.targetObj){try

            {targetObj=eval(options.targetObj) }

            catch(e){}if(typeof targetObj=="object"){targetId=targetObj
            }}if(!targetId)

            {targetId=attachId }

            if(!myparams.targetId)

            {myparams.targetId=targetId }

            myparams.type=options.type;
            if(!options.event){with(window){eval(options.name+"=function(){return Richfaces.processEffect(Object.extend(this,arguments[0]||{}));}.bind(myparams)")
            }}else{var ename=Richfaces.effectEventOnOut(options.event||"");
            if(ename){var bindedFunction=function(event)

            {return Richfaces.processEffect(this) }

            .bindAsEventListener(myparams);
            Event.observe(attachId,ename,bindedFunction,myparams.useCapture||false)
            }}}
            ;


            if you do not use bulk js. then do the same in the file processEffect.js

            Show
            enda Tomas Cerny added a comment - - edited Here is a workaround: go to file ui.pack.js and replace variable "params" for "myparams" in the part related to processEffect.js if(!Richfaces.effect){Richfaces.effect={} }Richfaces.effect.create=function(options){if(!options){options={} }var myparams=options.params||{}; options.params=null; var attachObj; var targetObj; var targetId=options.targetId; var attachId=options.attachId; if(options.attachObj){try {attachObj=eval(options.attachObj) } catch(e){}if(typeof attachObj=="object"){attachId=attachObj }}if(options.targetObj){try {targetObj=eval(options.targetObj) } catch(e){}if(typeof targetObj=="object"){targetId=targetObj }}if(!targetId) {targetId=attachId } if(!myparams.targetId) {myparams.targetId=targetId } myparams.type=options.type; if(!options.event){with(window){eval(options.name+"=function(){return Richfaces.processEffect(Object.extend(this,arguments [0] ||{}));}.bind(myparams)") }}else{var ename=Richfaces.effectEventOnOut(options.event||""); if(ename){var bindedFunction=function(event) {return Richfaces.processEffect(this) } .bindAsEventListener(myparams); Event.observe(attachId,ename,bindedFunction,myparams.useCapture||false) }}} ; if you do not use bulk js. then do the same in the file processEffect.js
            Hide
            bendi Marek Będkowski added a comment -

            Patch to processEffect removing with and eval statements.

            Show
            bendi Marek Będkowski added a comment - Patch to processEffect removing with and eval statements.
            Hide
            bendi Marek Będkowski added a comment - - edited

            Hi

            Since the problem still exists in 3.3.3.Final I decided to prepare a patch (processEffect.js.patch) to the formentioned processEffect.js file - I got rid of 'with' and 'eval' evils and seems to do the trick

            @Thomas - I tried swapping variable name from params to myparams but it made no difference.

            Show
            bendi Marek Będkowski added a comment - - edited Hi Since the problem still exists in 3.3.3.Final I decided to prepare a patch (processEffect.js.patch) to the formentioned processEffect.js file - I got rid of 'with' and 'eval' evils and seems to do the trick @Thomas - I tried swapping variable name from params to myparams but it made no difference.
            Hide
            michpetrov Michal Petrov added a comment -

            RichFaces 3.X is discontinued and so this issue is not going to be fixed. With no update in the past 2 years it is assumed that any community suggestions or workarounds have been sorted out. (Bulk closing).

            Show
            michpetrov Michal Petrov added a comment - RichFaces 3.X is discontinued and so this issue is not going to be fixed. With no update in the past 2 years it is assumed that any community suggestions or workarounds have been sorted out. (Bulk closing).

              People

              • Assignee:
                Unassigned
                Reporter:
                enda Tomas Cerny
              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development