You can drag a Button component from the Palette's Woodstock Basic category to the Visual Designer to create a button that the user can click to perform an action like submitting or resetting a form.
When the web page is generated, the Button becomes an HTML <input type="type">
element for which the type value can be submit
or reset
.
After dragging the button to the Visual Designer, you can:
text
property.id
attribute. In the page bean, this property's value is the name of the Button
object.If necessary, you can add an image file to your list of resources in the property editor by choosing Add File. After selecting a file, you see the image displayed on your button. You can see any images you add to your list of resources in the under project-name > Web Pages > resources.
<input>
element's type
is image
and the button is a submit button that uses the specified image. text
property.If all you want to do is have the button display another page when the user clicks it, you do not need an action method. The easiest thing to do is open the page in the Navigation Editor, click the page and then click the button, and then drag to the page you want the button to open. See Setting Up Static Page Navigation for more information.
If you want the button to be able to determine which page to open based on certain conditions, then you need an action method. The action method typically processes button clicks and returns a string indicating the name of a page navigation case (the page in your application to display next). The default name for the method is button-id
_action
, where button-id is the value of the button's id
property. For more information, see Setting Up Dynamic Page Navigation.
text
property to an object or a data provider, as described in the topic Bind to Data Dialog Box. text
property to other objects or bean properties that update this component's properties automatically.