user2665694
user2665694

Reputation:

Triggering an overlay through Javascript in Plone

I defined my overlay for like that

    $j('#heise').prepOverlay(
    {   
        subtype: 'ajax',
        noform: function(el) {return noformerrorshow(el, 'close');}
    }

(which is working perfectly fine).

Now I need to trigger the overlay manually.

The user enters some data into so form and upon form submission the result should be displayed inside the overflow. Modifying the 'href' value with the form parameters is no problem however I don't know how to trigger the appearance of the overlay manually through Javascript. I found the low-level overlay() API method of jqueryTools but it's not helpful here. Any idea?

Upvotes: 0

Views: 872

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1125048

The normal way to open a jQueryTools overlay is through .load() on the overlay API, but .prepOverlay hides all that in it's own wrapper in place for ajax style overlays. You can do one of two things:

  1. Call the click handler:

    jQuery('#heise').click();
    

    This will trigger the correct handlers for all click events.

  2. Call the pb.ajax_click handler directly, binding this to your element:

    pb.ajax_click.apply(jQuery('#heise'));
    

    This only will trigger the ajax click handler.

Upvotes: 1

Related Questions