Feb 24, 2011

Setting constraints on a Dojo control

Constraints in Dojo are objects passed to functions responsible for validating, parsing, and formatting the data in the box, and various properties may be provided to override system or locale-specific defaults.

I was having difficulty finding an example used in XPages. Code below is a constraint used on a dijit.form.NumberTextBox. I'm just setting the number pattern to accept a number with a comma. You can setup multiple constraints...just separate with semi-colons.

<xp:inputText value="#{document.Number}" id="number1" dojoType="dijit.form.NumberTextBox">
    <xp:this.dojoAttributes>
        <xp:dojoAttribute name="constraints" value="{pattern: '#,##0'}"></xp:dojoAttribute>
    </xp:this.dojoAttributes>
</xp:inputText>

Feb 17, 2011

Dojo tab container code

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom" dojoTheme="true" dojoParseOnLoad="true">

    <script type="text/javascript">
        dojo.require("dijit.layout.ContentPane");
        dojo.require("dijit.layout.TabContainer");
    </script>

    <h1>Tab Container</h1>
    <div id="mainTabContainer" dojoType="dijit.layout.TabContainer"
        style="width:900px;height:500px">
        <div id="tab1" dojoType="dijit.layout.ContentPane"
            title="First Tab" selected="true">
            First Tab
        </div>
        <div id="tab2" dojoType="dijit.layout.ContentPane"
            title="Second Tab">
            Second Tab
        </div>
        <div id="tab3" dojoType="dijit.layout.ContentPane"
            title="Third Tab">
            Third Tab
        </div>
    </div>
</xp:view>

Feb 8, 2011

Excellent XPages Resources

Here is a list of links that will be updated periodically with helpful XPages resources.

Xpages.info
Planet Lotus
XPages: Tutorials
Learning XPages by Declan Lynch
Wissel.net
XPages Blog
Notes In 9
DontPanic

Embracing XPages

<xp:label value="Hello World."></xp:label>