blob: 418c51d776972a5820aee154bc0db01ffbdb1ace [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
<h4 class="samplesGroup">Dynamic selection list update</h4>
<title>Country selector</title>
<para>This example illustrates how you can programmatically update the
content of a selection list using a collection built in the flow.</para>
<para>
This sample illustrates event-handling in Cocoon Forms and how selection lists can be changed
programmatically.
</para>
<para>
Event-handlers are defined in the form definition to update the selection lists and set
the comment text below the table. This requires only a few lines of server-side JavaScript.
Selection widgets also have a "submit-on-change" attribute set in the form template so that
changes are considered immediately by the server.
</para>
<para>
See "countryselector_form.xml" and "countryselector_template.xml" to see how this is done.
</para>
<content>
<ft:form-template action="countryselector" method="POST">
<ft:continuation-id/>
<fi:group>
<fi:styling layout="columns"/>
<fi:items>
<ft:widget id="us-nonus"/>
<ft:widget id="country"/>
<ft:widget id="message"/>
<input type="submit"/>
</fi:items>
</fi:group>
</ft:form-template>
</content>
<para>
<a href="./">Back to Forms samples</a>
</para>
</page>