The input tag for a form submit button typically has this format:
<dsp:input type="submit" bean="
prop-spec
" submitvalue="
prop
-
value
" value="
label
"/>
bean
specifies the component property to set when the user clicks the submit button.submitvalue
specifies value to set forprop-spec
when the user clicks on this submit button. This attribute overrides thevalue
-specified value, which is otherwise used to set the property.value
specifies the text to display on the submit button.
Using Submit Buttons to Set Property Values
The non-standard submitvalue
attribute lets you differentiate the button label text from the property value you wish to set. If you omit this attribute, DAF uses the standard value
attribute to set the bean
-specified property. Used together, value
specifies only the button label text, 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 buttons. 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 Buttons
An image can act as a submit control. When the user clicks the image, the image input submits the form. The img
attribute specifies the pathname of the image file, relative to the form page. 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.