Re: modalWindow Plugin

would be great, thanks mentor!

Re: modalWindow Plugin

Also from me, that would be great !

Re: modalWindow Plugin

Found for us a temp work around:

changed in modalwindow.js

if(undefined==command.objDoc.openmW){command.objDoc.openmW=0; to command.objDoc.openmW=0; (line 62)

removed command.objDoc.openmW++; (line 63)

And we removed the divs:
$objResponse->remove('popupdiv');
$objResponse->remove('xjxmWc_0');
$objResponse->remove('xjxmW_0');

popupdiv is the id of the div we show

Re: modalWindow Plugin

Hey guys, finally got around to looking at this thread again.

I took a look into the problem y'all were having and I have fixed the bug that was causing it.

There was an error in the way the PHP code was setup to issue the ajax command. I also updated the javascript a bit to reflect the new changes in the PHP file.

You can grab the fixed version at: www.gfx-null.com/MW/modalWindow.zip

Enjoy,
Metric

Re: modalWindow Plugin

Metric, thank you. Will test it asap smile

Re: modalWindow Plugin

works great! many thanks, metric!

Re: modalWindow Plugin

Hey metric, I think there's kind of a bug in your "bOverlayClick" extension - in firefox there's no problem but in internet explorer 7 / 8 i won't get it working. Everythings ok, the plugin works great and the modal window is closable by clicking the close link but the eventhandler somehow somehow doesn't work (I don't get any report or error message, neither by activatiing xajax debug mode nor in the internet explorer error console).

Regardless of this I'll still keep using the modalwindow plugin. I only use it in an administation utility, so I'm ok with clicking on a close link... ;-)

Thanks for this great work to all of you!

Re: modalWindow Plugin

dhh wrote:

Hey metric, I think there's kind of a bug in your "bOverlayClick" extension - in firefox there's no problem but in internet explorer 7 / 8 i won't get it working. Everythings ok, the plugin works great and the modal window is closable by clicking the close link but the eventhandler somehow somehow doesn't work (I don't get any report or error message, neither by activatiing xajax debug mode nor in the internet explorer error console).

Regardless of this I'll still keep using the modalwindow plugin. I only use it in an administation utility, so I'm ok with clicking on a close link... ;-)

Thanks for this great work to all of you!

dhh, I noticed that also. It is due to not having propery <!doctype> at the top of the html page. The page must be in proper standards mode for it to work properly. You may have also noticed that the box is not properly centered when the proper doctype is not defined at the top of the html.

See: http://hsivonen.iki.fi/doctype/ for more info on the different standards.

Firefox has a feature that automatically determines the page doctype if one is not specified, but IE 8, 7, and 6 do not.

Re: modalWindow Plugin

metric wrote:

dhh, I noticed that also. It is due to not having propery <!doctype> at the top of the html page. The page must be in proper standards mode for it to work properly. You may have also noticed that the box is not properly centered when the proper doctype is not defined at the top of the html.

See: http://hsivonen.iki.fi/doctype/ for more info on the different standards.

Firefox has a feature that automatically determines the page doctype if one is not specified, but IE 8, 7, and 6 do not.


Hey metric, thank you for this possible solution - I'll try this as soon as I'll be back at work on tuesday!

Re: modalWindow Plugin

Well, I made a testcase now as I'm not back working again.  I tried this:

<?php
echo '<?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">

and the same without the xml header:


<!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">

The onclick event now works correctly - but the contents are not centered yet, this is my content:

    $msg = "<div id='msg'>"
         . $msg."<br />"
         . "<img src='images/ajax_processing.gif' alt='please wait />"
         . "</div>";

The $msg var only contains text without formatting, is then surrounded by divs and the ajax processing gif as you can see in the code before, and this is my modalwindow command

    $objResponse->clsmodalWindow->addWindow($msg, array('color' => '#000000',
            'opacity' => 90,
            'frame' => 'parent',
            'bOverlay' => true,
            'bOverlayClick' => true,
            'classname' => "msg"
        ));

Any idea why the content isn't centered correctly?

Re: modalWindow Plugin

hi

is there a possibility to give a form input field focus within a modal window?

my form:

$output = '
    <div class="modal_content_container">
      <form name="f_register" id="f_register" method="post" action="">
        <label for="register_email">Email</label>
        <input id="register_email" type="text" name="register_email" />
        <input id="register_submit" type="submit" name="register_submit" value="Submit" onclick="xajax_ModalLogin('2', xajax.getFormValues('f_register')); return false;" />
      </form>
    </div>';

$objResponse->clsmodalWindow->addWindow( $output, array('color' => '#000000', 'opacity'    => 60, 'frame' => 'parent', 'bOverlay' => true));

i've tried:

$objResponse->script("setTimeout(xajax.$('register_email').focus, 1);");

-> i get the following error in firebug:
uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0" data: no]

$objResponse->script('document.getElementById("register_email").focus');

-> no error but no focus at all

$objResponse->script("xajax.$('register_email').focus");

-> no error but no focus at all

any help would be appreciated!! many thanks in advance
bambi

Re: modalWindow Plugin

focus is a function so try focus() on that element

Re: modalWindow Plugin

well, what a foolish question... hmm
thanks for your input, mentor. works like a charm now.
bambi

Re: modalWindow Plugin

Where is the latest download located?

Thanks,
Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

90 (edited by metric 2009-08-23 6:37:01 PM)

Re: modalWindow Plugin

dhh wrote:

Well, I made a testcase now as I'm not back working again.  I tried this:

<?php
echo '<?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">

and the same without the xml header:


<!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">

The onclick event now works correctly - but the contents are not centered yet, this is my content:

    $msg = "<div id='msg'>"
         . $msg."<br />"
         . "<img src='images/ajax_processing.gif' alt='please wait />"
         . "</div>";

The $msg var only contains text without formatting, is then surrounded by divs and the ajax processing gif as you can see in the code before, and this is my modalwindow command

    $objResponse->clsmodalWindow->addWindow($msg, array('color' => '#000000',
            'opacity' => 90,
            'frame' => 'parent',
            'bOverlay' => true,
            'bOverlayClick' => true,
            'classname' => "msg"
        ));

Any idea why the content isn't centered correctly?


What does your CSS look like for the msg div?

Here is CSS I use for the div that contains information / onloading:

.info {
    position: absolute;
    text-align: center;
    padding: 5px;
    top: 50%;
    left: 50%;
    display: block;
    z-index: 1200;
    width: 400px;
    background-color: #666666;
    border: 1px solid #FFFFFF;
    color: #FFFFFF;
}

With that CSS it centers it just fine, once I put in the doc header.

I do not put the box in with the main html, instead I just let the model box insert the div into the page.

Here is what my doc header looks like:

<?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" xml:lang="en" lang="en">
  <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

Sorry, for such a late reply, but I have been busy with work and other things.

I hope this helps,
Metric

P.S. forgot one other thing:

This is what my call to the model window looks like:

$response->clsmodalWindow->addWindow($html, array('color' => '#000000', 'opacity' => 50, 'frame' => 'parent', 'bOverlay' => true, 'bOverlayClick' => true));

Re: modalWindow Plugin

m[e]ntor wrote:

Hi,

every webdeveloper know the problem: How can i validate formdata without the stupid javascript alert,confirm or prompt function.

The solution ist this new Plugin.

One year ago i changed the lightbox into a lockbox which allows me to open in multi-layering new windows in a webapplication.
And now i changed it again into a xajaxplugin.

It is simple to use, create your ajax-object and include the Plugin:

$core = './xajax/xajax_core';
require_once( $core . '/xajax.inc.php' );
$xajax = new xajax();
require_once( $core . '/xajaxPlugin.inc.php' );
require_once( $core . '/xajaxPluginManager.inc.php' );
require_once './xajax/xajax_plugins/response/modalWindow/modalWindow.inc.php';

Create with your template-engine e.g. smarty a window-content  und put them to the response:

$objResponse = new xajaxResponse();
$objResponse->plugin( 'clsmodalWindow', 'addWindow', $windowcontent);

or use $backgroundcolorm, $opacity ( 0-100 ) and $classname to define the style of youzr "lightbox"

$objResponse->plugin( 'clsmodalWindow', 'addWindow', $windowcontent, $backgroundcolor, $opacity, $className );

with the following code you can close the highest window:

$objResponse->plugin( 'clsmodalWindow', 'closeWindow');

or you use the close alias in your html:

onclick="xajax.closeWindow()"


You can find a Demo an the Download on my page:

Download: http://www.amp-lified.de/index.php?lnk= … &fid=2
Demo: http://www.amp-lified.de/modalWindow/

The download includes the demo-file.

BTW:

this plugin includes a function named "postLoadClientScript"

if you want to include the javascript of this plugin on demand, and not on every pagecall include that plugin on your xajax-function and before you create your response object. After that and before you want open a new Window use the following code:


require_once './xajax/xajax_plugins/response/modalWindow/modalWindow.inc.php';
$objResponse = new xajaxResponse();
$objResponse->plugin( 'clsmodalWindow', 'postLoadClientScript');
$objResponse->plugin( 'clsmodalWindow', 'addWindow', $windowcontent);

the browser waits until the script is post-loaded and create after that your new window.

Feel free to use it and post comments.

The links above do not longer exist. Could you please send me a working link to get modalWindow plugin for XAJAX?... Thanks