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
Jagadeesh AdaveniJagadeesh Adaveni 

ApexPages.message(ApexPages.severity.ERROR,'Please select Box to save'));) gets fired need some error sound

Hi,

I have Apexpage messages in my controller, when my page message(ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select Box to save'));) gets fired need some error sound.
How can i do this?
please give me any suggestions

Thanks,
A.Jagadees. 
 
3 Creeks3 Creeks
I am not aware of anyway to so this in Apex or Visualforce.  You could probably do it with Javascript by adding a listener to determine when a message appears on the screen and then inserting a sound object onto the page.
Jagadeesh AdaveniJagadeesh Adaveni
Thanks for your response.
Could you please give sample code snippet.
3 Creeks3 Creeks
<audio autoplay="false" muted="true" id="beep">
   		<source src="{!URLFOR($Resource.MyStaticResources, 'beep.mp3')}" type="audio/mp3"/>
 </audio>

<script>
   j$(document).ready(function() { beepOnError(); } );  

   function beepOnError() {
   		if ( j$(".messageTable").length > 0 ) {
   			j$("#beep").removeProp('muted') 	
   		} else {
   			j$("#beep").prop('muted')
   		}
   	}
</script>
The above uses jQuery but you should get the idea.  Also, this code was not thoroughly tested but seems to work.