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
HARSHABKHARSHABK 

Alert message for list view custom button

Hi,

           I have created a mass update button on custom object using Visualforce. Visualforce page works fine but we need to have alert message (Select the row you want to update) on custom button on the list page.

Can someone guide me through this with sample code as I am new to Visualforce and Javascript.

Thanks

AmphroAmphro

So you create the button in visualforce? In that case you could try something like this.

<apex:actionFunction action="{!someAction}" name="someAction"/>
<apex:commandButton onclick="myFunc();"/>

<script>
function myFunc() {
if (someCondition)
alert("Error has occured");
else
someAction();
}
</script>

I typed this off the top of my head so it won't be a direct translation, but it should get you on your way.