The input tag for a form submit control can have one of these two formats:
<dsp:input type="submit"
[
bean="
prop-spec
"
[
submitvalue="
value
"
]
value="
value
"
]
/>
dsp:input type="image"
{
src|image
}
=path
[
bean="
prop-spec
" submitvalue="
value
""
]
/>
Submit Control Attributes
You can set the following attributes for a submit control:
Attribute | Description |
---|---|
type | Determines whether the submit control displays as a button or image. If set to |
| Specifies a component property to set when the user clicks the submit control. |
| Specifies the text to display on the submit button, if |
| Specifies a value to set on the |
Using Submit Controls to Set Property Values
A submit control can set the bean
-specified property through the standard value
attribute. The control can override its own value
setting through the non-standard submitvalue
attribute. Used together, value
specifies only the button label text (if the input type
is set to submit
), and submitvalue
sets the property value. For example, the following tag creates a submit button with the label Click Here, and specifies to set Student_01.age
to 34
:
<dsp:input type="submit" bean="/samples/Student_01.age" submitvalue="34"
value="Click Here"/>
You typically set property values through data entry inputs and hidden inputs. Occasionally, however, you might want to associate property settings with submit controls. For example, a form might have multiple submit buttons, where each sets the same property to a different value. The following input tags define two submit buttons, each specifying the Boolean property Student_01.emailOK
:
<dsp:input type="submit" bean="/samples/Student_01.emailOK"
value="Send email" submitvalue="true" name="OK"/>
<dsp:input type="submit" bean="/samples/Student_01.emailOK"
value="Do not send email" submitvalue="false" name="notOK"/>
The first submit button sets the property to true; the second to false. Because the two input tags specify the same property, each requires a unique name
attribute.
Note: In general, two controls cannot be associated with the same property. In the previous example, the submit buttons can be associated with the same property because only one of them can be executed for a given form submission.
Using Images as Submit Controls
An image can act as a submit control. When the user clicks the image, the image input submits the form. The src
or image
attribute specifies the pathname of the image file. As with a submit button, the bean
attribute specifies a property to set on form submission, and submitvalue
specifies the value. For example:
<dsp:input bean="/samples/Student_01.emailOK" type="image"
src="clickpic.gif" submitvalue="true"/>
If you omit the submitvalue
attribute, the image pixel coordinates are submitted as the value.