Show TOC Start of Content Area

Background documentation Tool Bar Button  Locate the document in its SAP Library structure

Provides any type of functionality in your application at the touch of the button. Hints can be displayed as the mouse cursor passes over the button, or as the mouse button is pressed but not released. The toolbar button has to be used together with the "toolbar" control.

·        enabled

A boolean value that defines if the toolbar button is clickable. If the toolbar button is disabled (enabled="FALSE") it sends no event when you press a mouse button on the toolbar button. A disabled toolbar button has a different text color to show the user that it is disabled.

·        id

Identification name of the toolbar button.

·        onClick

Defines the event handling method that will be processed when the user clicks on the enabled button. If you do not define an 'onClick' event the button can be clicked but no event is generated.

·        onClientClick 

Defines the JavaScript fragment that is executed when the user clicks on the button. If both events ('onClick' and 'onClientClick') are specified, the 'onClientClick' event handling method is activated first. By default the 'onClick' event handling method is activated afterwards. In the JavaScript fragment you can cancel the activation of the 'onClick' event handling method with the command htmlbevent.cancelSubmit=true;

The 'onClientClick' event is useful to pre-process the form and only send the form to client if the pre-processing was successful (for example, date validation, valid number format and so on) to save client/server interaction.

This graphic is explained in the accompanying text

A button click usually activates the client/server interaction. If an input field has to be filled out for further processing, the JavaScript fragment can check the necessary input on the client side and display a message if the necessary input is missing, without server interaction.

 

Note

To use JavaScript the JSP has to use the page tag (set page tag).

·        text

Defines the string of text placed centered on the button. If no text should be displayed in the button an empty string (null) can be used. The width of the button is automatically adjusted to the length of the text.

·        tooltip

Defines the hint of the button which is displayed as the mouse cursor passes over the button, or as the mouse button is pressed but not released.

 

Attributes

M

Values

Usage

enabled

 

FALSE (d)
TRUE

Taglib
enabled="FALSE"

Classlib
setEnabled(false)

id

*

String (cs)

Taglib
id="OrderConfirm"

Classlib
setId("OrderConfirm")

text

 

String

Taglib
text="Confirm"

Classlib
setText("Confirm")

tooltip

 

String

Taglib
tooltip="Confirm order"

Classlib
setTooltip("Confirm order")

 

Events

M

Values

Usage

onClick

 

String (cs)

Taglib
onClick="ProcessConfirm"

Classlib
setOnClick("ProcessConfirm")

onClientClick

 

String (cs)

Taglib
onClientClick="alert('Confirm')"

Classlib
setOnClientClick("alert('Confirm')")

 

Example

using the taglib

  <hbj:toolbarButton id="OpenButton" 
    
text="Open"
    
onClick="ProcessOpen"
  
/>

 

using the classlib

    ToolbarButton openButton = tb.addToolbarButton("OpenButton""Open");
    openButton.setOnClick(
"ProcessOpen");

 

Result

The toolbar button has to be used in the toolbar control. See the "toolbar" control description for the result.

 

 

End of Content Area