You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/07/26 22:33:33 UTC
svn commit: r425835 - in /tapestry/tapestry4/trunk: ./ src/site/
src/site/apt/UsersGuide/ src/site/apt/javascript/
src/site/resources/images/UsersGuide/ src/site/xdoc/components/
tapestry-framework/src/java/org/apache/tapestry/form/ tapestry-framework/...
Author: jkuhnert
Date: Wed Jul 26 13:33:32 2006
New Revision: 425835
URL: http://svn.apache.org/viewvc?rev=425835&view=rev
Log:
Added first pass at the tapestry javascript reference documentation.
Added validation documentation on client side validation to satisfy TAPESTRY-801.
Added ValidatableFieldSupport logic to make Checkbox component capable of being validated, as was noticed on
the users list.
Added:
tapestry/tapestry4/trunk/src/site/apt/UsersGuide/clientside-validation.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/
tapestry/tapestry4/trunk/src/site/apt/javascript/core.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/form-validation.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/html.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/index.apt
tapestry/tapestry4/trunk/src/site/apt/javascript/packaging.apt
tapestry/tapestry4/trunk/src/site/resources/images/UsersGuide/validation-dialog.png (with props)
Modified:
tapestry/tapestry4/trunk/pom.xml
tapestry/tapestry4/trunk/src/site/site.xml
tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Checkbox.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestCheckbox.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestTextField.java
Modified: tapestry/tapestry4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Wed Jul 26 13:33:32 2006
@@ -263,6 +263,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </plugin>
</plugins>
</pluginManagement>
</build>
Added: tapestry/tapestry4/trunk/src/site/apt/UsersGuide/clientside-validation.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/UsersGuide/clientside-validation.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/UsersGuide/clientside-validation.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/UsersGuide/clientside-validation.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,95 @@
+ ------
+Client-Side Validation
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+Client-Side Validation
+
+ Client side validation in Tapestry is now moving towards being just as powerful as its
+ server side counterpart, if not more so. To use the client side API all you need to do
+ is set the <<<clientValidationEnabled>>> parameter to <<<true>>> on your
+ {{{../components/Form.html}Form}} and it will automatically be setup for you.
+
+ This document will focus on how you can customize and interact with the default tapestry javascript
+ validation system, leaving the normal {{{validation.html}Input Validation}} guide as the core resource
+ for configuring and using validation in general.
+
+ <<See also:>> Tapestry {{{../javascript/form.html}Form}} JavaScript API reference.
+
+* Configuring CSS definitions
+
+ One of the largest changes made to Tapestry 4.1 was the complete replacement of most of the javascript
+ functions in the framework, including validation. As part of this change the new validation API doesn't
+ use window <<<alert>>> <alert('Clicked!')> dialogs anymore. The new system uses a
+ combination of {{{http://dojotoolkit.org}dojo}} dhtml widgets and <<<CSSS>>> rules to apply UI hints
+ to form fields with missing or invalid data.
+
+ There are now two core CSS classes that you must define for your input fields. There names are:
+
+ * <<fieldMissing>> - Applied to form input fields that are required and missing a selection/input value.
+
+ * <<fieldInvalid>> - Applied to form input fields that have <invalid> data. A field could be invalid for
+ a number of reasons, like an integer value not being within a certain range or a
+ {{{../components/DatePicker.html}date}} field being in an invalid format.
+
+ []
+
+ By default Tapestry <<does not>> define these two css classes, you must define them yourself in order to
+ see the classes applied to your forms. The TimeTracker demo application has defined these two css classes
+ as:
+
++----------------------------------------------
+.fieldMissing {
+ background: #bedef4;
+}
+
+.fieldInvalid {
+ background: #ffaf7e;
+ font-weight: bold;
+}
++----------------------------------------------
+
+** Dojo dialog CSS definitions
+
+ This is still a questionable default, but for now the new way that error messages are presented to users
+ is with a client side {{{http://dojotoolkit.org}dojo}} Dialog widget.
+
+[../images/UsersGuide/validation-dialog.png] Validation dialog example.
+
+ Much like the core validation system, the presentation of the validation dialog is also controlled by user
+ defined css rules:
+
+ * <<missingList>> - Applied to a block of <<< <ul><li>Message</li></ul> >>> html content for messages
+ resulting from missing fields.
+
+ * <<invalidList>> - Applied to a block of <<< <ul><li>Message</li></ul> >>> html content for messages
+ resulting from invalid fields.
+
+ []
+
+ The TimeTracker demo application also defines a default set of classes to handle the dialog classes:
+
++-----------------------------------------------
+.missingList, .invalidList {
+ padding: 0.6em;
+ padding-top: 0.2em;
+ width:100%;
+ display:block;
+}
+
+.missingList {
+ border-top: 4px solid #bedef4;
+}
+
+.invalidList {
+ border-top: 4px solid #ffaf7e;
+}
+
+.missingList li, .invalidList li {
+ list-style:none;
+ font-style:italic;
+}
++-----------------------------------------------
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/core.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/core.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/core.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/core.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,110 @@
+ ------
+JavaScript Reference - tapestry core
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+tapestry core API
+
+ This package defines the core API included on all pages by default. Most of it has to do with managing
+ IO requests, as well as handling remote server exception pages resulting from asynchronous IO calls.
+
+ The source for <<<tapestry.core>>> can be found {{{http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?view=markup}here}}.
+
+* tapestry.version
+
+ A string property that defines the current version of the Tapestry JavaScript core API.
+
+ An example that would show the current version might be:
+
++----------------------
+alert("Current tapestry version is " + tapestry.version);
++----------------------
+
+* tapestry.bind(url, content, json)
+
+ Global XHR bind function for tapestry internals. The error/load functions defined in
+ this package are used to handle load/error of dojo.io.bind.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ url | String | yes | | The url to bind the request to.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ content | json | no | | A properties map of optional extra content to send. This will be appended to the URL in the form of name/value query parameters.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ json | boolean | no | false | Optional parameter specifying whether or not to create a json request. If not specified the default is to use XHR.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+ <<See also:>> Dojo {{{http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book8}IO}}.
+
+** Example bind call
+
+ The bind call is fairly simple in implementation as it uses the dojo {{{http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book8}IO}} API
+ to make XHR calls back to tapestry.(or any web url really)
+
++-----------------------------------
+var url="http://localhost:8080/app";
+var content={chosenBook:"Cryptonomicon",numberOfCopies:"10"};
+
+tapestry.bind(url, content);
++-----------------------------------
+
++-------------------------
+<script type="text/javascript">
+ dojo.require("tapestry.form");
+
+ tapestry.form.submit(dojo.byId("myform"));
+</script>
++-------------------------
+
+* tapestry.error(type, exception, http, kwArgs)
+
+ Global error handling function for dojo.io.bind requests. This function is used by all of the IO
+ functions used in tapestry to handle IO errors. The default behaviour of this function is to display
+ a special {{{exceptions.html}Exception}} dojo widget displaying any errors received from the server. If
+ no server exceptions are available the only other action taken is logging the error in the browser
+ via <<<dojo.log.exception(message, exception)>>>.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ type | Object | no | | The error type receieved.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ exception | Object | no | | The javascript exception that was thrown. (if any)
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ http | XmlHttpRequest| no | | The XmlHttpRequest object used to make the IO requests. (implementation dependant on browser being used)
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ kwArgs | JSON | no | | The original set of arguments passed in to dojo.io.bind() when the IO request was made.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+ If you would like to handle errors differently you can either override the definition of
+ <<<tapestry.error>>> with your own function or be notified when it is executed via:
+
++-----------------------
+dojo.event.connect(tapestry, "error", function(type, exception, http, kwArgs){
+ // insert your logic for handling errors here, this function will be called ~after~
+ // the core tapestry.error function is called with the above style dojo.event.connect call
+});
++-----------------------
+
+* tapestry.load(type, data, http, kwArgs)
+
+ The core function registered to handle loading XHR requests. (Xml requests) The implementation details
+ are fairly complicated for this function as they handle parsing/managing Tapestry-defined XML content
+ nodes in a format recognized by the API so that intelligent handling of partial updates/javascript/etc
+ can be handled on the client.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ type | Object | no | | The error type receieved.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ data | XML Object | no | | The data recieved in the request. Should be a javascript Xml document.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ http | XmlHttpRequest| no | | The XmlHttpRequest object used to make the IO requests. (implementation dependant on browser being used)
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ kwArgs | JSON | no | | The original set of arguments passed in to dojo.io.bind() when the IO request was made.
+*----------------------*---------------*------------*----------*----------------------------------------------+
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/form-validation.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/form-validation.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/form-validation.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/form-validation.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,164 @@
+ ------
+JavaScript Reference - tapestry.form.validation
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+tapestry.form.validation
+
+ Defines the default client side validation logic which will be invoked by {{{../components/Form.html}Form}} components
+ with the <<<clientValidationEnabled>>> parameter set to true. You can override as little or as much of the default
+ logic as you would like.
+
+ The source for <<<tapestry.form.validation>>> can be found {{{http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form/validation.js?view=markup}here}}.
+
+ <<See also:>> {{{../UsersGuide/clientside-validation.html}Client-Side Validation}}, {{{form.html}Form}} JavaScript Reference
+
+* tapestry.form.validation.missingClass
+
+ The default CSS class name that will be applied to input fields with missing values. <(also applies to other field
+ types, like <select> elements)>.
+
+ The current default value is <<fieldMissing>>.
+
+* tapestry.form.validation.invalidClass
+
+ The default CSS class name that will be applied to input fields with invalid values. <(also applies to other field
+ types, like <select> elements)>.
+
+ The current default value is <<fieldInvalid>>.
+
+* tapestry.form.validation.validateForm(form, profileProperties)
+
+ Main entry point for running form validation. The props object passed in contains a number of
+ fields that are managed by tapestry.form.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profileProperties | json | no | | A properties object containing tapestry specific form information, as well as the dojo {{{form.html}validation profile}}s registered with this form.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+ <<Returns:>> Boolean - If true then form validation passed and the form should be allowed to
+ submit to the server, if false the form submission is cancelled and will not
+ be posted to the server.
+
+** Example
+
+ Sample properties format style used:
+
++----------------------------------------------------------
+props = {
+ // whether to run validation at all
+ validateForm:[true|false],
+
+ // set of dojo.validate.check() style profiles
+ // that may have been registered with form
+ profiles:[profile1, profile2]
+}
++----------------------------------------------------------
+
+ The individual profiles will contain any of the data described by the dojo documentation
+ for <<<dojo.validate.check(form, profile)>>>. In addition to that, each profile will also have a
+ corresponding string message to display if the specified condition has been met.
+
+ For example, if you have specified that a select field named <<<select1>>> was required your
+ profile would look something like:
+
++----------------------------------------------------------
+profile = {
+ "required":["select1"], // normal dojo.validate.check data
+ "select1":{ // tapestry field/error type specific data
+ "required":"You must select a value for select1."
+ }
+}
++----------------------------------------------------------
+
+ It is intended for you to call <<<dojo.validate.check(form, profile)>>> for each profile stored in
+ the <<<profiles>>> field, as well as deciding how to display errors / warnings.
+
+* tapestry.form.validation.processResults(form, results, profile)
+
+ Called for each registered profile on a form after <<<dojo.validate.check()>>> has been called.
+ This function is expected to do UI related notifications of fields in error.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | Form node | yes | | The form node that was processed.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ results | JSON | yes | | The result of calling <<<dojo.validate.check(form,profile)>>>.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profile | JSON | yes | | The original profile used to validate form, also holds validation error messages to be used for each field.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+ <<Returns:>> Boolean - If <<<false>>> the form should not be submitted and all validation
+ should be stopped. If <<<true>>> validation will continue and eventually
+ form will be submitted. <(if no other validation logic fails)>
+
+* tapestry.form.validation.handleMissingField(field, profile)
+
+ Default field decorator for missing fields.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ field | element id | yes | | The field element that was missing data.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profile | JSON | yes | | The form validation profile.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.validation.handleInvalidField(field, profile)
+
+ Default field decorator for invalid fields.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ field | element id | yes | | The field element that had invalid data.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profile | JSON | yes | | The form validation profile.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.validation.clearValidationDecorations(field, profileProperties)
+
+ Clears out previous css classes set on fields during previous validation checks. This is called
+ by <<<tapestry.form.validation.validateForm>>> just before running validation to ensure that any
+ fields previously decorated with css rules reflect any changes users may have made to make them
+ valid during the next validation check.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ field | element id | yes | | The field element to clear UI validation decorations on.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profileProperties | json | no | | A properties object containing tapestry specific form information, as well as the dojo {{{form.html}validation profile}}s registered with this field's form.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.validation.summarizeErrors(form, results, profile)
+
+ Optionally allows an alert dialog/dhtml dialog/etc to be displayed to user to alert them
+ to the invalid state of their form if validation errors have occurred.
+
+ This function is called by the default Tapestry client side form validation semantics to
+ present a modal summary dialog to the user listing the error messages that indicate why
+ their fields are in error.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | Form node | yes | | The form node that was processed.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ results | JSON | yes | | The result of calling <<<dojo.validate.check(form,profile)>>>.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profileProperties | json | yes | | A properties object containing tapestry specific form information, as well as the dojo {{{form.html}validation profile}}s registered with this field's form.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+** Example
+
+[../images/UsersGuide/validation-dialog.png] Validation dialog example.
+
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,230 @@
+ ------
+JavaScript Reference - tapestry.form
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+tapestry.form
+
+ The form package defines the core functionality used in tapestry to interact with forms, as well as kicking
+ off the {{{../UsersGuide/clientside-validation.html}client side validation}} process when forms are submitted.
+
+ All forms registered with the core tapestry client side form manager will by default have event listeners
+ bound to them that will invoke any registered validation profiles when the form is submitted. <(by listening
+ to the form "onsubmit" event defined by all browser forms)>
+
+ The source for <<<tapestry.form>>> can be found {{{http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=markup}here}}.
+
+* tapestry.form.registerForm(form)
+
+ Registers a reference to a form that will be managed by tapestry. If the form passed in has already
+ been registered the call will be ignored. The majority of the form functions in this package require that
+ this one first be called or a client side exception will be thrown.(Via dojo, so browser logging will make
+ it look pretty.)
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form to register or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+** Example usage
+
+ This example takes an existing form and registers it.
+
++----------------------------
+<form id="myform" action="/app" >
+ <fieldset>
+ <label for="firstName">First Name</label>
+ <input type="text" id="firstName" name="firstName" />
+ </fieldset>
+</form>
+
+<script type="text/javascript">
+dojo.require("tapestry.form");
+
+// could also be tapestry.form.registerForm(dojo.byId("myform"))
+tapestry.form.registerForm("myform");
+</script>
+
++----------------------------
+
+* tapestry.form.registerProfile(form, profile)
+
+ Registers a form validation/translation profile. There can potentially be more than
+ one profile registered with a form. <(such as when you want to register additional validation
+ logic to an existing form without overriding the default tapestry validation profile)>
+
+ The profiles will be consulted at various points in the forms life, which currently only
+ involves running the profile checks before form submission. <(more points to be determined in the future)>
+
+ If no form has previosly been registered via <<<tapestry.form.registerForm(form)>>> matching the specified
+ <<<form>>> an exception will be raised.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form to register the profile for, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ profile | JSON | yes | | The JSON object structure representing the logic that should be used to validate this form.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+** Dojo validation profiles
+
+ The new tapestry client side validation API relies completely on the logic provided by the
+ <<<dojo.validate.check(form, profile)>>> function. This section will probably be undergoing more extensive
+ documentation at some point, but for now the jsdoc comments in dojo are pasted in below. <(tapestry profile
+ specifics are covered in the javascript {{{validation.html}Validation}} section)>.
+
+ <<See also:>> <<<dojo.validate.common>>> {{{http://archive.dojotoolkit.org/nightly/src/validate/common.js}source}}
+
+ <<Dojo Documentation>> <(pulled from dojo.validate.common)>:
+
+*** Procedural API Description
+
+ The main aim is to make input validation expressible in a simple format. You define profiles
+ which declare the required and optional fields and any constraints they might have. The results
+ are provided as an object that makes it easy to handle missing and invalid input.
+
+ <<Usage:>>
+
++------------------------------------------------------
+var results = dojo.validate.check(form, profile);
++------------------------------------------------------
+
+ <<Profile Object:>>
+
++--------------------------------------------------------------------------------------------
+var profile = {
+ // filters change the field value and are applied before validation.
+ trim: ["tx1", "tx2"],
+ uppercase: ["tx9"],
+ lowercase: ["tx5", "tx6", "tx7"],
+ ucfirst: ["tx10"],
+ digit: ["tx11"],
+
+ // required input fields that are blank will be reported missing.
+ // required radio button groups and drop-down lists with no selection will be reported missing.
+ // checkbox groups and selectboxes can be required to have more than one value selected.
+ // List required fields by name and use this notation to require more than one value: {checkboxgroup: 2}, {selectboxname: 3}.
+ required: ["tx7", "tx8", "pw1", "ta1", "rb1", "rb2", "cb3", "s1", {"doubledip":2}, {"tripledip":3}],
+
+ // dependant/conditional fields are required if the target field is present and not blank.
+ // At present only textbox, password, and textarea fields are supported.
+ dependancies: {
+ cc_exp: "cc_no",
+ cc_type: "cc_no",
+ },
+
+ // Fields can be validated using any boolean valued function.
+ // Use arrays to specify parameters in addition to the field value.
+ constraints: {
+ field_name1: myValidationFunction,
+ field_name2: dojo.validate.isInteger,
+ field_name3: [myValidationFunction, additional parameters],
+ field_name4: [dojo.validate.isValidDate, "YYYY.MM.DD"],
+ field_name5: [dojo.validate.isEmailAddress, false, true],
+ },
+
+ // Confirm is a sort of conditional validation.
+ // It associates each field in its property list with another field whose value should be equal.
+ // If the values are not equal, the field in the property list is reported as Invalid. Unless the target field is blank.
+ confirm: {
+ email_confirm: "email",
+ pw2: "pw1",
+ }
+};
++--------------------------------------------------------------------------------------------
+
+ <<Results Object:>>
+
++------------------------------------------------------------------------------------------
+isSuccessful(): Returns true if there were no invalid or missing fields, else it returns false.
+hasMissing(): Returns true if the results contain any missing fields.
+getMissing(): Returns a list of required fields that have values missing.
+isMissing(field): Returns true if the field is required and the value is missing.
+hasInvalid(): Returns true if the results contain fields with invalid data.
+getInvalid(): Returns a list of fields that have invalid values.
+isInvalid(field): Returns true if the field has an invalid value.
++------------------------------------------------------------------------------------------
+
+* tapestry.form.clearProfiles(form)
+
+ Clears any previously registered validation profiles on the specified form. Normally called
+ during XHR requests by returned JS response to ensure new validation logic coming in from
+ potentially new/changing form fields is accounted for.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.setFormValidating(form, validate)
+
+ If a form registered matching the specified <<<form>>> exists a local property will be set
+ that causes validation to be turned on/off depending on the argument.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ validate | boolean | yes | | If true, turns form client side validation on (the default) - false turns validation off.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.submit(form, submitName)
+
+ Submits the form specified, optionally setting the submitname hidden input field to the value
+ of <<<submitName>>> to let the {{{../components/Form.html}Form}} component on the server know
+ which button caused the submission. (For the case of submit button listeners).
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ submitName | String | no | | Optional submit name string to use when submitting.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.cancel(form)
+
+ Submits the form specified, and also sets the hidden form input field controlled by tapestry that
+ specifies the <<<submitmode>>> used so that if you have registered a <<<cancel listener>>> on your
+ {{{../components/Form.html}Form}} component it will be called by this invocation.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.refresh(form)
+
+ Submits the form specified, and also sets the hidden form input field controlled by tapestry that
+ specifies the <<<submitmode>>> used so that if you have registered a <<<refresh listener>>> on your
+ {{{../components/Form.html}Form}} component it will be called by this invocation.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+* tapestry.form.submitAsync(form, content, submitName)
+
+ Similar to the {{{core.html}tapestry.bind}} function call, in that it submits the request asynchronously and
+ expects a valid tapestry xml content response. This is the core function used by Tapestry when submitting
+ forms asynchronously. The same load/error handling functions are called as in {{{core.html}tapestry.bind}}.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ form | String element id / HTMLForm node | yes | | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ content | json | no | | A properties map of optional extra content to send. This will be sent <in addition> to the content encapsulated by your form.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ submitName | String | no | | Optional submit name string to use when submitting to bind the request to a specific {{{../components/Submit.html}Submit}} component.
+*----------------------*---------------*------------*----------*----------------------------------------------+
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/html.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/html.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/html.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/html.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,58 @@
+ ------
+JavaScript Reference - tapestry.html
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+tapestry.html
+
+ This package currently only defines one DOM String related function.
+
+ The source for <<<tapestry.html>>> can be found {{{http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js?view=markup}here}}.
+
+* tapestry.html.getContentAsString(node)
+
+ Used primarily in {{{core.html}tapestry.bind}} to convert incoming XML document node content into a
+ javascript String that will be compatible with DomNode.innerHTML calls. The semantics of using innerHTML
+ are fairly quircky from browser to browser <(if you want to maintain stylesheet rules/etc)>, so this function
+ will determine your browser type and act accordingly. It should universally be able to produce a String compatible
+ with innerHTML statements from almost any source, even existing HTML DOM nodes that aren't part of an IO
+ XML document return.
+
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ Parameter | Type | Required | Default | Description
+*----------------------*---------------*------------*----------*----------------------------------------------+
+ node | DOMNode/HtmlDOMNode | yes | | The XML or HTML DOM node to parse html textual fragment contents from.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+
+** Example usage
+
+ If you wanted to take an IO return chunk of xml that looked like this:
+
++----------------------------
+<?xml version="1.0"?>
+<ajax-response>
+<response id="chunk1" type="element">
+This is some example html content.
+
+<p>
+As you can see, any valid html element can be embedded in the response.
+</p>
+</response>
+</ajax-response>
++----------------------------
+
+ and place it's content into an existing HTML dom node you might do something like this:
+
++-----------------------------------------------------------
+dojo.require("tapestry.html"); // ensures tapestry.html package is loaded
+
+var xmlData=functionFoo();
+var domNode = xmlData.getElementById("chunk1");
+
+dojo.byId("myHtmlNode").innerHTML=tapestry.html.getContentAsString(domNode);
++-----------------------------------------------------------
+
+ <<See also:>> {{{http://developer.mozilla.org/en/docs/DOM:document#1022427}Mozilla DOM reference}}
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/index.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/index.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/index.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,35 @@
+ ------
+JavaScript Reference - Introduction
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+Introduction
+
+ Tapestry makes extensive use of the {{{http://dojotoolkit.org}dojo}} toolkit library to facilitate
+ easier client side management / communication. Without a better way to automate the documentation process
+ for javascript this section will attemp to define the most important Tapestry javascript functions/objects
+ available.
+
+ By default, the {{{../components/Shell.html}Shell}} component will include the core
+ {{{http://dojotoolkit.org}dojo}} javascript object <<<dojo.js>>>, as well as the new core
+ Tapestry javascript object - <<<core.js>>>. This means that you don't have to worry about how to include
+ dojo or Tapestry javascript on any of your pages, they will already be available.
+
+ All of the Tapestry javascript is heavily documented in <<<jsdoc>>> style javadoc formatting. If you
+ would like to see the source yourself and bypass the online docs you may view it
+ {{{http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/}here}}.
+
+* Dojo documentation
+
+ For documentation related to {{{http://dojotoolkit.org}dojo}}, please see the resources available on
+ the dojo website:
+
+ * {{http://manual.dojotoolkit.org/}} - The dojo manual.
+
+ * {{http://dojo.jot.com}} - The dojo wiki.
+
+ []
+
\ No newline at end of file
Added: tapestry/tapestry4/trunk/src/site/apt/javascript/packaging.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/packaging.apt?rev=425835&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/packaging.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/packaging.apt Wed Jul 26 13:33:32 2006
@@ -0,0 +1,54 @@
+ ------
+JavaScript Reference - Packaging
+ ------
+Jesse Kuhnert
+ ------
+26 July 2006
+ ------
+
+Packaging
+
+ The Tapestry javascript API uses the dojo
+ {{{http://manual.dojotoolkit.org/WikiHome/DojoDotBook/BookModules}packaging system}} to include
+ both dojo and Tapestry javascript files on the fly.
+
+ This means that most of the API is broken up over a number of files that will be optionally included
+ automatically - only when you need them. As an example, this is how you would import the Tapestry
+ form related functions onto your page:
+
++-------------------------
+<script type="text/javascript">
+ dojo.require("tapestry.form");
+
+ tapestry.form.submit(dojo.byId("myform"));
+</script>
++-------------------------
+
+* Download/Performance concerns of included JavaScript
+
+ A very valid concern that a lot of users will worry about is the performance impact of including all of
+ this JavaScript on their pages! This is still a very grey area that may change to meet real world needs
+ as they come up, but the following is the current thinking behind this:
+
+ * The bundled {{{http://dojotoolkit.org}dojo}} core javascript file that is included by default is
+ only about <<<176k>>> in size. This is fairly small compared to the average size of most images displayed
+ in web applications.
+
+ * Part of the beauty of the dojo {{{http://manual.dojotoolkit.org/WikiHome/DojoDotBook/BookModules}packaging}}
+ system is that you can build very small core javascript files and only have your web application incur performance
+ hits for additional functionality <(like widgets)> when you need it. This should keep your app nice and slim
+ in most areas.
+
+ * Overhauled Tapestry {{{../tapestry-framework/apidocs/org/apache/tapestry/asset/AssetService.html}AssetService}}
+ implementation that does a much better job at properly interpreting and setting the correct browser cache
+ settings on included asset resources, like dojo and Tapestry javascript API files/resources. It even goes as far
+ as serving up the files via a new hivemind configuration point that eliminates the need to have an MD5 hash
+ string in the include URL's, making application restarts have no effect on user browser caching of your
+ javascript files.
+
+ []
+
+ As mentioned previously, this area of Tapestry is not set in stone. The new move to
+ {{{http://maven.apache.org}maven2}} has made doing snapshot updates of Tapestry very easy, so if/when
+ issues are found/addressed people should be able to get updated versions pretty quickly.
+
\ No newline at end of file
Added: tapestry/tapestry4/trunk/src/site/resources/images/UsersGuide/validation-dialog.png
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/resources/images/UsersGuide/validation-dialog.png?rev=425835&view=auto
==============================================================================
Binary file - no diff available.
Propchange: tapestry/tapestry4/trunk/src/site/resources/images/UsersGuide/validation-dialog.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: tapestry/tapestry4/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/site.xml?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/site.xml (original)
+++ tapestry/tapestry4/trunk/src/site/site.xml Wed Jul 26 13:33:32 2006
@@ -37,6 +37,7 @@
<menu name="Quick Links" inherit="top" >
<item name="Home" href="/index.html" />
+ <item name="Blog" href="http://howardlewisship.com/blog/" />
<item name="Download" href="http://tapestry.apache.org/tapestry4.1/download.html" />
<item name="Wiki" href="http://wiki.apache.org/tapestry/" />
<item name="FAQ" href="http://tapestry.apache.org/tapestry4.1/faq.html" />
@@ -44,6 +45,13 @@
<menu name="Documentation" >
+ <item name="Quick Start" href="/QuickStart/helloworld.html" collapse="true">
+ <item name="Hello World" href="/QuickStart/helloworld.html" />
+ <item name="Direct Links" href="/QuickStart/directlink.html" />
+ <item name="Forms" href="/QuickStart/forms.html" />
+ <item name="Contributed" href="/QuickStart/contributed.html" />
+ </item>
+
<item name="Users Guide" href="/UsersGuide/index.html" collapse="true">
<item name="Introduction" href="/UsersGuide/index.html" />
<item name="Templates" href="/UsersGuide/template.html" />
@@ -51,6 +59,7 @@
<item name="Listeners" href="/UsersGuide/listenermethods.html" />
<item name="Page Classes" href="/UsersGuide/page-class.html" />
<item name="Input Validation" href="/UsersGuide/validation.html" />
+ <item name="Client-Side Validation" href="/UsersGuide/clientside-validation.html" />
<item name="Creating Components" href="/UsersGuide/components.html" />
<item name="Property Injection" href="/UsersGuide/injection.html" />
<item name="Localization" href="/UsersGuide/localization.html" />
@@ -65,11 +74,13 @@
<item name="Script Template DTD" href="/UsersGuide/script.html" />
</item>
- <item name="Quick Start" href="/QuickStart/helloworld.html" collapse="true">
- <item name="Hello World" href="/QuickStart/helloworld.html" />
- <item name="Direct Links" href="/QuickStart/directlink.html" />
- <item name="Forms" href="/QuickStart/forms.html" />
- <item name="Contributed" href="/QuickStart/contributed.html" />
+ <item name="JavaScript Reference" href="/javascript/index.html" collapse="true">
+ <item name="Introduction" href="/javascript/index.html" />
+ <item name="Packaging" href="/javascript/packaging.html" />
+ <item name="Core" href="/javascript/core.html" />
+ <item name="Html" href="/javascript/html.html" />
+ <item name="Form" href="/javascript/form.html" />
+ <item name="Validation" href="/javascript/form-validation.html" />
</item>
<item name="Examples" href="/exampleapps/index.html" />
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml Wed Jul 26 13:33:32 2006
@@ -240,9 +240,9 @@
<em>type, src, border</em>
</p>
- <p>
+ <span class="warn">
<strong>Warning:</strong>
- <br />
+ <p>
In Tapestry 3.0, the behavior of the ImageSubmit was
<em>undeferred</em>
, the equivalent of setting the defer parameter to false. The default for the
@@ -250,7 +250,8 @@
<strong>true</strong>
, which may in rare cases, cause problems when upgrading an applicaton from 3.0
to 4.0.
- </p>
+ </p>
+ </span>
</section>
@@ -295,7 +296,7 @@
<p>
This is a variation of the example for the
- <a href="site:Submit">Submit</a>
+ <a href="Submit.html">Submit</a>
component; it uses images instead of ordinary clickable buttons for the help and
login actions.
</p>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Checkbox.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Checkbox.java?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Checkbox.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Checkbox.java Wed Jul 26 13:33:32 2006
@@ -35,6 +35,8 @@
*/
protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
{
+ renderDelegatePrefix(writer, cycle);
+
writer.beginEmpty("input");
writer.attribute("type", "checkbox");
@@ -48,9 +50,13 @@
renderIdAttribute(writer, cycle);
+ getValidatableFieldSupport().renderContributions(this, writer, cycle);
+
renderInformalParameters(writer, cycle);
writer.closeTag();
+
+ renderDelegateSuffix(writer, cycle);
}
/**
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestCheckbox.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestCheckbox.java?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestCheckbox.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestCheckbox.java Wed Jul 26 13:33:32 2006
@@ -24,6 +24,7 @@
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.valid.IValidationDelegate;
+import org.apache.tapestry.valid.ValidationConstants;
import org.apache.tapestry.valid.ValidatorException;
import org.testng.annotations.Test;
@@ -38,29 +39,78 @@
{
public void testRenderChecked()
{
+ ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
+
Checkbox cb = newInstance(Checkbox.class, new Object[]
- { "name", "assignedName", "value", Boolean.TRUE });
-
+ { "name", "assignedName", "value", Boolean.TRUE, "validatableFieldSupport", vfs });
+
+ IForm form = newMock(IForm.class);
+
IMarkupWriter writer = newBufferWriter();
IRequestCycle cycle = newCycle();
+ IValidationDelegate delegate = newDelegate();
+
+ trainGetForm(cycle, form);
+ trainWasPrerendered(form, writer, cb, false);
+ trainGetDelegate(form, delegate);
+
+ delegate.setFormComponent(cb);
+
+ trainGetElementId(form, cb, "barney");
+
+ trainIsRewinding(form, false);
+
+ expect(cycle.isRewinding()).andReturn(false);
+
+ form.setFormFieldUpdating(true);
+
+ trainGetDelegate(form, delegate);
+
+ delegate.writePrefix(writer, cycle, cb, null);
+
+ vfs.renderContributions(cb, writer, cycle);
+
+ trainGetDelegate(form, delegate);
+
+ delegate.writeSuffix(writer, cycle, cb, null);
+
+ expect(delegate.isInError()).andReturn(false);
+
+ delegate.registerForFocus(cb, ValidationConstants.NORMAL_FIELD);
+
replay();
- cb.renderFormComponent(writer, cycle);
+ cb.render(writer, cycle);
verify();
- assertBuffer("<input type=\"checkbox\" name=\"assignedName\" checked=\"checked\"/>");
+ assertBuffer("<input type=\"checkbox\" name=\"barney\" checked=\"checked\"/>");
}
public void testRenderDisabled()
{
+ IForm form = newMock(IForm.class);
+ ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
+
Checkbox cb = newInstance(Checkbox.class, new Object[]
- { "name", "assignedName", "disabled", Boolean.TRUE });
-
+ { "name", "assignedName", "disabled", Boolean.TRUE,
+ "form", form, "validatableFieldSupport", vfs});
+
IMarkupWriter writer = newBufferWriter();
IRequestCycle cycle = newCycle();
-
+
+ IValidationDelegate delegate = newDelegate();
+
+ trainGetDelegate(form, delegate);
+ delegate.writePrefix(writer, cycle, cb, null);
+
+ vfs.renderContributions(cb, writer, cycle);
+
+ trainGetDelegate(form, delegate);
+
+ delegate.writeSuffix(writer, cycle, cb, null);
+
replay();
cb.renderFormComponent(writer, cycle);
@@ -72,17 +122,30 @@
public void testRenderInformalParameters()
{
+ IForm form = newMock(IForm.class);
+ ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
+
Checkbox cb = newInstance(Checkbox.class, new Object[]
{ "name", "assignedName", "value", Boolean.TRUE, "specification",
- new ComponentSpecification() });
-
+ new ComponentSpecification(),
+ "form", form, "validatableFieldSupport", vfs});
+
IMarkupWriter writer = newBufferWriter();
IRequestCycle cycle = newCycle();
-
+
IBinding binding = newBinding("informal-value");
cb.setBinding("informal", binding);
-
+
+ IValidationDelegate delegate = newDelegate();
+
+ trainGetDelegate(form, delegate);
+ delegate.writePrefix(writer, cycle, cb, null);
+
+ vfs.renderContributions(cb, writer, cycle);
+
+ delegate.writeSuffix(writer, cycle, cb, null);
+
replay();
cb.renderFormComponent(writer, cycle);
@@ -94,12 +157,31 @@
public void testRenderWithId()
{
+ IForm form = newMock(IForm.class);
+ ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
+
Checkbox cb = newInstance(Checkbox.class, new Object[]
- { "idParameter", "foo", "name", "assignedName", "value", Boolean.TRUE });
-
+ { "idParameter", "foo", "name", "assignedName", "value", Boolean.TRUE,
+ "form", form, "validatableFieldSupport", vfs});
+
IMarkupWriter writer = newBufferWriter();
- IRequestCycle cycle = newCycleGetUniqueId("foo", "foo$unique");
-
+ IRequestCycle cycle = newCycle();
+
+ IValidationDelegate delegate = newDelegate();
+ trainGetDelegate(form, delegate);
+
+ // IRequestCycle cycle = newCycleGetUniqueId("foo", "foo$unique");
+
+ delegate.writePrefix(writer, cycle, cb, null);
+
+ expect(cycle.getUniqueId("foo")).andReturn("foo$unique");
+
+ vfs.renderContributions(cb, writer, cycle);
+
+ trainGetDelegate(form, delegate);
+
+ delegate.writeSuffix(writer, cycle, cb, null);
+
replay();
cb.renderFormComponent(writer, cycle);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestTextField.java?rev=425835&r1=425834&r2=425835&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestTextField.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestTextField.java Wed Jul 26 13:33:32 2006
@@ -53,7 +53,7 @@
IMarkupWriter writer = newWriter();
IValidationDelegate delegate = newDelegate();
-
+
trainGetForm(cycle, form);
trainWasPrerendered(form, writer, component, false);
trainGetDelegate(form, delegate);