Close a multibox from javascript using box.close()

lightbox that supports images, flash, video, mp3s, html

Close a multibox from javascript using box.close()

by menou on Fri Sep 19, 2008 5:13 pm

Hi guys,

I'm having trouble with box.close() and I don't know why.

On a page I use a multibox (with AJAX) to print an HTML form in a window, I call it like this :

Code: Select all

<a id="mb_forward" class="mb_forward" rel="width:500,ajax:true" href="mypage.php">test</a>

<script type="text/javascript">
   var box_forward = {};
   window.addEvent('domready', function(){
      box_forward = new MultiBox('mb_forward', {
         openFromLink: true,
         useOverlay: false,
         showControls: false
      });
   });
</script>


In the page mypage.php I have an HTML FORM which I submit with AJAX with the following code :

Code: Select all
  <script type="text/javascript">
      
            function closeMultibox() {
               parent.box.close();
            }
      
            $('myForm').addEvent('submit', function(e) {
               new Event(e).stop();
               this.send({
                  update: res,
                  onComplete: function() {
                     res.removeClass('ajax-loading');
                  },
                  onSuccess: function() {
                     var ret = $('ares').value;
                     if (ret == 0) {
                        setTimeout("closeMultibox()", 3000);
                     }
                  },
               });
            });
         </script>


Everything works fine except the closeMultibox() function, I get this error :


reference to undefined property this.contentEffects
[Break on this error] this.contentEffects.start({
multibox.js (ligne 479)

this.contentEffects is undefined
[Break on this error] this.contentEffects.start({



And I don't know why

Do you have an idea ?
menou
 
Posts: 1
Joined: Fri Sep 19, 2008 4:07 pm

Return to multibox

Who is online

Users browsing this forum: Alexa [Bot] and 0 guests