<dsp:postfield[
name="input-name
"]
bean="property-spec
"[
"source-spec
"]
[
checked=
"{true|false}"]
[
default=
"value
"]
[
priority=integer-value]
[
submit
value="value
"]
/>
Usage Notes
dsp:postfield
creates an object that accepts user input much like the WML tag postfield
. You can use dsp:postfield
to pass data to a component property or page parameter. Sometimes the input field displays with a value, which can be the current value in the property specified for update or another value provided as default.
You can also use dsp:postfield
to process a form by making a call to a handler method. When you use this tag, make sure it is enclosed in a dsp:go
tag. dsp:postfield
must be used in the context of a dsp:go
tag so it is executed by a submit handler method.
name
Assigns a name to this input field, which enables access to it during form processing. If no name is provided, the ATG platform automatically supplies one.
bean
Specifies the property that this input field updates on form submission: its Nucleus path, component name, and property name. The property specification can also include a tag converter, such as date or null. For more information, see Tag Converters in Chapter 2. For example:
<dsp:postfield bean="/atg/userprofiling/ProfileFormHandler.name" required="true"/>
The bean
attribute for a submit control can also specify a form handler operation such as cancel or update. For example:
<dsp:postfield type="submit" bean=/atg/userprofiling/ProfileFormHandler.cancel"/>
source-spec
Specifies to prepopulate the input field from one of the following sources:
beanvalue="
property
-
spec
"
Specifies a property value, where
property-spec
includes a Nucleus path, component name, and property name. For example:bean="Student_01.firstClass" beanvalue="FreshmanScience.name"
paramvalue="
param-name
"
Specifies the value from the page parameter
param-name
. For example:bean="Student_01.name" paramvalue="name"
value="
value
"
Specifies a static value. For example:
bean="Student_01.enrolled" value="true"
If source-value
is omitted, the input field contains the target property’s current value.
priority
Specifies the priority of this input field during form processing, relative to other input fields. This attribute can be especially helpful when making changes to an item’s repository ID and the properties it contains. If you first update the supplemental properties and then the repository ID, the new property values can be flushed when the repository ID change occurs. By default, priority
is set to –10.
For more information on how the ATG platform can prioritize tag processing, see Order of Tag Processing
submitvalue
Sets the bean
-specified property on form submission. The value must be a constant. For example:
<dsp:postfield bean="/TestData/Student_01.age" submitvalue="34"
value="Click here"/>
Example
<p>Login:<input type="text" name="login" title="login"/></p> <p>Password:<input type="password" name="password" title="password"/></p> <do type="accept" label="<i18n:message key="login"/>"> <dsp:go href='<%= request.getContextPath() +"/wml/login.jsp"%>' method="post"> <dsp:postfield bean="ProfileFormHandler.value.login" value="$login" /> <dsp:postfield bean="ProfileFormHandler.value.password" value="$password" /> <dsp:postfield bean="ProfileFormHandler.login" value="Log in" /> <dsp:postfield bean="ProfileFormHandler.loginSuccessURL" value="/Form Success.jsp" /> </dsp:go> </do>
This example shows an excerpt from a login form. Notice that login and password entered by the user in the input fields are saved to WML parameters $login
and $password
respectively. This makes the login and password available to other tags on the page, so the dsp:postfield
tag can save them to the ProfileFormHandler
properties. By setting the user inputs to the property values via WML variables, you are able to workaround the dsp:postfield
constraint that prevents you from saving the user input to a component property directly.
The dsp:postfield
tag calls the login handler method so when a submit control is clicked, the ATG platform validates the login/password pair in the ProfileFormHandler
. After the ATG platform accepts the login/password pair, the user is directed to the page identified in loginSuccessURL
, which is set to FormSuccess.jsp
.