function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John L.John L. 

toolbarGroup onclick attribute doesn't seem to work

My thought was that the following Visualforce code would create a toolbar containing the word "Data", and that clicking on the word would produce a JavaScript alert message.
 
<apex:toolbar id="theToolbar">
    <apex:toolbarGroup onclick="javascript: window.alert('myData');" id="Data">
        <apex:outputText value="Data"/>
    </apex:toolbarGroup>
</apex:toolbar>
Much to my surprise, nothing happens.

Thanks in advance for any help you can provide.
 
Suraj TripathiSuraj Tripathi
Hi John,
You can use  JavaScript alert message directly in <apex:toolbar>.
<!-- Page: -->
<apex:page id="thePage">
    <apex:toolbar onclick="javascript: window.alert('myData')" id="theToolbar">
        <apex:outputText value="Data"/>
    </apex:toolbar>
</apex:page>

Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards ,
Suraj​

 
John L.John L.
I have other similar <apex:toolbarGroup> tags that I would like to add at the same level. They have been omitted for clarity.

My thinking is that the supplied code seems to not work correctly, according to the design. Does anyone concur?