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
dgindydgindy 

Alerts

Is there way to send a message to the user from the Apex code like the "Alert" function in javascript when you are running pagereference funcitons?
jeffdonthemicjeffdonthemic
Yes! You can write error/info messages to the user via Apex using  ApexPages.addMessage.

You see an example of this by clicking the "See Results" button on the following example. Do a search but do not check any of the checkboxes. The code essentially ensures that at least one checkbox is selected before viewing the results.

http://jeffdouglas-developer-edition.na5.force.com/examples/apex/category_search

The code that fires this is on line 64 of the CategorySearchController:

http://blog.jeffdouglas.com/2009/01/13/apex-search-with-checkbox-results/

Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com