My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 15 (4 days ago) by andrej.okonetschnikow
Labels: Deprecated, Help
CallBacks  
Callbacks reference

Introduction

This page describes callbacks available for use in ModalBox.

Details

There are couple of callbacks supported by ModalBox. Here they are:

IMPORTANT NOTICE. Each callback is being removed from options of the ModalBox after execution.

Examples


Comment by goo...@primetimesolutions.com, Aug 27, 2007

hi

Comment by sanketrajdeora, Oct 18, 2007

et

Comment by krzysztof.kotlarz, Dec 11, 2007

Hi! Is it or will be possible to launch callbacks when you click on overlay; similar to afterHide method.

I mean; something which you can switch on/off to launch some functions in case of clicking on overlay.

Of course I tried to modify the code and I was able to launch some functions afert clicking on overlay, but I had no influence on working or not working of fuctions which I was calling back.

Thank you for your response. Regards and thanks for good piece of code.

Comment by mr.juvenile, Mar 27, 2008

Is it possible to call a user defined javascript function from inside a call back.

Comment by MolikJain, Apr 04, 2008

Hi,

I want to recieve form post values from one modalbox to another consequent modalbox form.

I used $POST in php, but it is not receiving values.

What to do.

Thanks in advance.

Molik Jain

Comment by Justinasu, Jun 10, 2008

All calbacks don't like to get function names with brackets. Dont define afterHide: your_function_name() of the event will not work. this thing troubled me for a few hours.

Comment by t...@interdirect.co.uk, Jun 25, 2008

afterLoad doesn't seem to work in IE 7? My code is:

Modalbox.show('myURL', {title: 'Click the location on the map where this venue is located.', width: 650, height:550, afterLoad: function() { alert('Content loaded successfully')}});

This is on an onClick event in a href.

Comment by jonathan...@msn.com, Aug 22, 2008

In response to MolikJain?, in your Modalbox.show function add the line method: 'post' it is defaulted to $GET. <a href="URL HERE" onclick="Modalbox.show(this.href, {title: this.title, width: 300, method: 'post'}); return false;">

Comment by detooproject, Feb 14, 2009

how to validate html form?, submit button continuing without fill the field

Comment by beckingham, Mar 20, 2009

What Jusinasu said on Jun 10 2008 helped me immensely. The callbacks just don't call at the right time if you do that.

Comment by angeloimm, May 21, 2009

Hello. I'm trying to using modalbox in my project. I have this environment;

  • Spring 2.5.6
  • Spring JS taken from SpringWebFlow? 2.0.8
  • Ajaxtags 1.5
  • scriptaculous version 1.8.1
  • prototype version 1.6.0.3

I have a form where the user must fill some required fields; then he needs to check some not required options and i'ld love to open a modalbox; the user can check some checkbox; when he submit the form i must refresh a portion of the parent page.

So in my parent page i wrote:

<a href="#" id="eleCate" name="eleCate" class="button" onclick="Modalbox.show('elencoCategorie.controller?modelId=choosenCategories', {title: '<fmt:message key="chooseCategories"></fmt:message>', beforeHide: function(){ window.serializedForm = Form.serialize('ilForm'); }, afterHide: function() { alert('serializedForm'+serializedForm); $('paginaPopup').update(serializedForm) }}); return false;">Elenco categorie</a>

where in Form.serialize i passed the id/name of the form presents in my modalbox. In my modalbox i have: <!-- elencoCategorie.jsp --> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%> <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <form action="#" method="post" id="ilForm" name="ilForm" > <c:choose>

<c:when test="${not empty categorie}">
<ul>
<c:forEach var="categoria" items="${categorie}">
<li>
<input type="checkbox" id="${categoria.categoryId}" name="<c:out value="${status.expression}"/>" value="${categoria.categoryId}" <c:if test="${status.value}">checked</c:if> /> ${categoria.name}
</li>
</c:forEach>
</ul>
</c:when> <c:otherwise>
<fmt:message key="noCategoryPresent"></fmt:message>
</c:otherwise>
</c:choose>
<input type="text" value="angelo">
<input type="submit" value="conferma" onclick="submitts()" class="button"> <a href="#" onclick="Modalbox.hide(); return false;" class="button"> <fmt:message key="btnCancel"/> </a> </form> <!-- Fine elencoCategorie.jsp -->

For now the submit does nothing; i'ld love to update the parent dom portion as in the sample Modalbox beforeHide callback test but it seems not work...am i missing anyhting? Regards,

Angelo.

Comment by andrew2686, Jul 24, 2009

Hi. This is grate lib!!! But, I have some problem. How can I change position of window?

Thanks!

Andrew.

Comment by archie.sheran, Jul 29, 2009

Same question as andrew I would like to reposition the modalbox so it comes out of the bottom or it does not come out of the top of the page, say same position of the browser but different position in the page, how can I do this? Is it even possible?

Thanks,

Archie.

Comment by keyurvaghani, Sep 24, 2009

hi,

i have to submit modalbox form on the same file for example, it is registration file once it is stored user details after validation checking then i want to close current modalbox and open next screen is say it email varification modalbox. So, i have opened this next modalbox on call back "afterHide" of current modalbox hide but it keeps this call back for all next newly opened screen and when i clicked on close (X), i am not able close this newly appeared modalbox and show me repeated loop for showing and hiding event of modalbox.

script like this once the modalbox submit on same page: 1. check validations 2. store value to database 3. close the current modalbox and set newly modalbox.show() on callback of "afterHide" on hide()of curr. modalbox means

Modalbox.hide({afterHide:function(){Modalbox.show(next_URL,{title:'title',width:'300',height:'200',method:'get'})}});

Anyone here who will help me to digout this issue? or what is the correct solution for it?

Please provide me solution as earliest as possible, if anyone have

Thanks a lot, Keyur

Comment by giorgiomarciano, Oct 08, 2009

Hi to all,

i'm trying to hide the Modalbox popup afterHide event, this is the code:

public static native void showConfirmPopup (String title, String content, ConfirmCallback? callback) /-{

$wnd.nativeExtensions = false; var result=""; $wnd.Modalbox.show('<p>content</p><input type=\'button\' value=
\'Yes\' onclick=\"result=this.value; Modalbox.hide({afterHide: function (btnID) {callba...@org.ratis.gui.system.client.effects.TBKEffect.ConfirmCallback?::execute (Ljava/lang/String;)(result)}}) \" /> or <input type=\'button\' value= \'No\' onclick=\" result=this.value; Modalbox.hide() \" /></div>', {title: title, width: 300});
}-/;

where is called the java method for the callback:

public static interface ConfirmCallback? {

void execute(String btnID);
}

With this code i get the error: missing ) after argument list.

If i try to replace the code within the hide method with a simple alert:

$wnd.Modalbox.show('<p>content</p><input type=\'button\' value=\'Yes\' onclick=\"result=this.value; Modalbox.hide({alert(result)}) \" /> or <input type=\'button\' value=\'No\' onclick=\" result=this.value; Modalbox.hide() \" /></div>', {title: title, width: 300});

everything works good, but if i have the java method call: callba...@org.ratis.gui.system.client.effects.TBKEffect.ConfirmCallback?::execute (Ljava/lang/String;)(result)

the code raise that strange error.

I tried to remove the ";" at the end of Ljava/lang/String; but i get a new error: callback is not defined

Could someone help me please? it's really strange and annoying..

thanks very much

Comment by remanvar, Dec 06, 2009

To these following queries... << Comment by andrew2686, Jul 24, 2009 Hi. This is grate lib!!! But, I have some problem. How can I change position of window?

Thanks!

Andrew.

Comment by archie.sheran, Jul 29, 2009 Same question as andrew I would like to reposition the modalbox so it comes out of the bottom or it does not come out of the top of the page, say same position of the browser but different position in the page, how can I do this? Is it even possible?

Thanks,

Archie. >>

What i did :

i changed the following function in modalbox.js as

setPosition: function () {

this.MBwindow).setStyle({left: (($(this.MBoverlay).getWidth() - $(this.MBwindow).getWidth()) / 2 ) + "px"}); $(this.MBwindow).setStyle({top: 140 + "px"}); },

there bu the top position moved from browser top to the 140 pixel down.

regards anvar

Comment by willemsen.christophe, Dec 13 (6 days ago)

Hello,

I'm trying to combine Modalbox and CKEditor. From now it's working at 90%, i can load a box with ckeditor insite, write a news and post it. My problem is that if i close the modalbox without submitting the form, when i want to reshow the modalbox the ckeditor is no more present.

Any idea ?


Sign in to add a comment
Hosted by Google Code