Run Application View Source Code

Orbeon Forms Apps

Orbeon Forms Source Code Viewer

Loading...
An error has occurred

An error has occurred in Orbeon Forms. You may want to try one of the following:

  • Close this dialog and continue to use this page.
  • Reload this page. Note that you will lose any unsaved changes.
  • If the above does not work, try reloading the page yourself. Note that you will lose any unsaved changes:

    • With Firefox and Safari: hold down the shift key and click the Reload button in your browser toolbar.
    • With Internet Explorer: hold down the control key and click the Reload button in your browser toolbar.
  • Return home.
Help
View as text View as text View as formatted XML View as formatted XML Download Download
atom.xpl 1,307
atom.xsl 3,510
page-flow.xml 1,033
sample-data.xml 2,821
schema.xsd 2,623
view.xhtml 11,198
$xforms-template-label$
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2007 Orbeon, Inc.

    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU Lesser General Public License as published by the Free Software Foundation; either version
    2.1 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU Lesser General Public License for more details.

    The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xhtml="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
    <head>
        <title>XForms Bookcast</title>
        <link rel="alternate" type="application/atom+xml" title="Orbeon XForms Bookcast Tutorial Feed" href="atom"/>
        <xforms:model schema="/apps/xforms-bookcast/schema.xsd">

            <!-- Load list of books when the XForms engine is ready -->
            <xforms:send ev:event="xforms-ready" submission="list-submission"/>

            <!-- Instance that contains all the books -->
            <xforms:instance id="books-instance">
                <books xmlns="">
                    <book>
                        <title/>
                        <author/>
                        <language/>
                        <link/>
                        <rating/>
                        <notes/>
                    </book>
                </books>
            </xforms:instance>

            <xforms:bind nodeset="instance('books-instance')/book">
                <xforms:bind nodeset="title" required="true()"/>
                <xforms:bind nodeset="author" required="true()"/>
            </xforms:bind>

            <xforms:instance id="book-template">
                <book xmlns="">
                    <title/>
                    <author/>
                    <language/>
                    <link/>
                    <rating/>
                    <notes/>
                </book>
            </xforms:instance>

            <xforms:instance id="languages-instance">
                <languages xmlns="">
                    <language>
                        <name>English</name>
                        <value>en</value>
                    </language>
                    <language>
                        <name>French</name>
                        <value>fr</value>
                    </language>
                    <language>
                        <name>Spanish</name>
                        <value>es</value>
                    </language>
                </languages>
            </xforms:instance>

            <xforms:instance id="ratings-instance">
                <ratings xmlns="">
                    <rating>
                        <name>1</name>
                        <value>1</value>
                    </rating>
                    <rating>
                        <name>2</name>
                        <value>2</value>
                    </rating>
                    <rating>
                        <name>3</name>
                        <value>3</value>
                    </rating>
                    <rating>
                        <name>4</name>
                        <value>4</value>
                    </rating>
                    <rating>
                        <name>5</name>
                        <value>5</value>
                    </rating>
                </ratings>
            </xforms:instance>

            <!-- Submission to get the document containing all the books -->
            <xforms:submission id="list-submission" serialize="false"
                       method="get" action="/exist/rest/db/orbeon/xforms-bookcast/books.xml"
                       replace="instance" instance="books-instance"/>

            <!-- Submission to save the document containing all the books -->
            <xforms:submission id="save-submission" ref="instance('books-instance')"
                    action="/exist/rest/db/orbeon/xforms-bookcast/books.xml"
                    method="put" replace="none">
                <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
            </xforms:submission>

            <!-- Submission to load the sample data -->
            <xforms:submission id="sample-data-submission" serialize="false"
                       method="get" action="oxf:/apps/xforms-bookcast/sample-data.xml"
                       replace="instance" instance="books-instance"/>

        </xforms:model>
        <!-- CSS style specific to this page -->
        <style type="text/css">
            .xforms-label { font-weight: bold }
            .books-label { display: -moz-inline-box; display: inline-block; width: expression('9em'); min-width: 9em; }
            .xforms-textarea-appearance-xxforms-autosize { width: 20em; margin-bottom: 2px  }
            .xforms-input input { width: 20em; margin-bottom: 2px }
            .xforms-select1 { margin-bottom: 2px }
            .xforms-select1 input { margin-bottom: 2px }
            .books-table { background-color: #fce5b6 }
            .books-table .add-td { width: 33em }
            .books-table .form-td { width: 33em; background: white; padding: .5em }
            .xforms-repeat-selected-item-1 .form-td { background: #ffc }
            /*.xforms-repeat-selected-item-1 .form-td .xforms-select1-appearance-minimal { background: white;  }*/
            .books-action-table { margin-bottom: 1em }
            .books-action-table td { white-space: nowrap; vertical-align: middle; padding-right: 1em }
            .books-action-table .xforms-submit img { vertical-align: middle }
            .books-action-table .xforms-trigger-appearance-minimal img { margin-right: 1em; vertical-align: middle }
        </style>
    </head>
    <body>
        <p>
            <i>This example is described in details in the <a href="/doc/intro-tutorial">Orbeon Forms Tutorial</a>.</i>
        </p>
        <!-- This table contains the main actions for the page  -->
        <table class="books-action-table">
            <tr>
                <td>
                    <xforms:submit submission="save-submission" appearance="minimal">
                        <xforms:label><img src="../apps/xforms-bookcast/images/save.gif" alt="Save"/> Save</xforms:label>
                    </xforms:submit>
                </td>
                <td>
                    <xforms:submit submission="list-submission" appearance="minimal">
                        <xforms:label><img src="../apps/xforms-bookcast/images/recycle-green.png" alt="Revert"/> Revert</xforms:label>
                    </xforms:submit>
                </td>
                <td>
                    <xforms:submit submission="sample-data-submission" appearance="minimal">
                        <xforms:label><img src="../apps/xforms-bookcast/images/add-all.gif" alt="Load Sample Data"/> Load Sample Data</xforms:label>
                    </xforms:submit>
                </td>
            </tr>
        </table>

        <!-- This table contains the list of books and the add/remove triggers -->
        <table class="books-table">
            <tr>
                <td>
                    <xforms:trigger appearance="minimal">
                        <xforms:label><img src="../apps/xforms-bookcast/images/add.gif"/></xforms:label>
                        <xforms:insert ev:event="DOMActivate" context="instance('books-instance')" nodeset="book" at="1" position="before" origin="instance('book-template')"/>
                    </xforms:trigger>
                </td>
                <td class="add-td">
                    <xforms:trigger appearance="minimal">
                        <xforms:label>Add One</xforms:label>
                        <xforms:insert ev:event="DOMActivate" context="instance('books-instance')" nodeset="book" at="1" position="before" origin="instance('book-template')"/>
                    </xforms:trigger>
                </td>
            </tr>
            <xforms:repeat nodeset="book" id="book-repeat">
                <tr>
                    <td>
                        <xforms:trigger appearance="minimal">
                            <xforms:delete ev:event="DOMActivate" context="instance('books-instance')" nodeset="book" at="index('book-repeat')"/>
                            <xforms:label><img src="../apps/xforms-bookcast/images/remove.gif"/></xforms:label>
                        </xforms:trigger>
                    </td>
                    <td class="form-td">
                        <xforms:input ref="title">
                            <xforms:label class="books-label">Title</xforms:label>
                        </xforms:input>
                        <br/>
                        <xforms:input ref="author">
                            <xforms:label class="books-label">Author</xforms:label>
                        </xforms:input>
                        <br/>
                        <xforms:select1 ref="language">
                            <xforms:label class="books-label">Language</xforms:label>
                            <xforms:item>
                                <xforms:label>Choose One...</xforms:label>
                                <xforms:value/>
                            </xforms:item>
                            <xforms:itemset nodeset="instance('languages-instance')/language">
                                <xforms:label ref="name"/>
                                <xforms:value ref="value"/>
                            </xforms:itemset>
                        </xforms:select1>
                        <br/>
                        <xforms:input ref="link">
                            <xforms:label class="books-label">Link</xforms:label>
                        </xforms:input>
                        <br/>
                        <xforms:select1 ref="rating" appearance="full">
                            <xforms:label class="books-label">Rating</xforms:label>
                            <xforms:item>
                                <xforms:label>None</xforms:label>
                                <xforms:value/>
                            </xforms:item>
                            <xforms:itemset nodeset="instance('ratings-instance')/rating">
                                <xforms:label ref="name"/>
                                <xforms:value ref="value"/>
                            </xforms:itemset>
                        </xforms:select1>
                        <br/>
                        <xforms:textarea ref="notes" appearance="xxforms:autosize">
                            <xforms:label class="books-label">Notes</xforms:label>
                        </xforms:textarea>
                    </td>
                </tr>
            </xforms:repeat>
        </table>
    </body>
</html>

Orbeon Forms 3.6.0.200712061930