users@woodstock.java.net

Re: Modal Dialog in 4.1.1

From: Jason Suplizio <suplizio_at_gmail.com>
Date: Tue, 4 Mar 2008 09:19:06 -0800

Steven,
I got the dojo dialog dijit working this morning and it didn't require any
magic, you just need to make certain that the parseOnLoad is set to true on
the woodstock head tag:

<f:view contentType="text/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:webuijsf="http://www.sun.com/webui/webuijsf">

    <webuijsf:page frame="false" xhtml="false">
        <webuijsf:html>
            <webuijsf:head id="head" title="Dialog Test" *
parseOnLoad="true">*
                <webuijsf:link url="/images/favicon.ico"/>
                <webuijsf:link type="text/css"
url="/styles/corporate/default.css"/>
                <ui:insert name="styles" />
                <ui:insert name="scripts" />
            </webuijsf:head>

            <webuijsf:body id="body" *styleClass="tundra*">
            <!-- the following is ripped
http://www.dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/layout/dialog -->
     <style type="text/css">
            @import "
http://o.aolcdn.com/dojo/1.0/dijit/themes/tundra/tundra.css";
               @import "http://o.aolcdn.com/dojo/1.0/dojo/resources/dojo.css
"
        </style>
        <script type="text/javascript">
           dojo.require("dojo.parser");
           dojo.require("dijit.form.Button");
           dojo.require("dijit.Dialog");
           dojo.require("dijit.form.TextBox");
           function checkPw(dialogFields) {
              if (dialogFields.confirmpw != dialogFields.newpw)
                 alert("Confirmation password is different. Password is
unchanged.");
           }
         </script>


        <button dojoType="dijit.form.Button"
onclick="dijit.byId('login_dialog').show();">Change
Password</button>
        <div dojoType="dijit.Dialog" id="login_dialog" title="First Dialog"
execute="checkPw(arguments[0]);">
            <table>
                <tr>
                <td><label for="name">Old Password: </label></td>
                        <td><input dojoType="dijit.form.TextBox"
type="password" name="oldpw"/></td>
                </tr>
                <tr>
                        <td><label for="loc">New Password: </label></td>
                        <td><input dojoType="dijit.form.TextBox"
type="password" name="newpw"/></td>
                </tr>
                <tr>
                        <td><label for="desc">Confirm New Password:
</label></td>
                        <td><input dojoType="dijit.form.TextBox"
type="password" name="confirmpw"/></td>
                </tr>
                <tr>
                        <td colspan="2" align="center">
                                <button dojoType="dijit.form.Button"
type="submit">OK</button></td>
                </tr>
            </table>
        </div>
               <!-- End dojo dialog stuff ripped from their website -->
            </webuijsf:body>
        </webuijsf:html>
    </webuijsf:page>
</f:view>