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
Ramandeep_SinghRamandeep_Singh 

Window.alert

Hi Guys,

I am trying to pop up a alert window when there is any change in the desired case field.
And then looked to online solution and got two diffrent codes, with one it is working with another it is not.
 
***********************************Working code*******************************
<apex:page standardController="case" rendered="{!(case.Case_Age__c>10 )}" > 

// Where Case_Age__c is a formula field to retrieve date from datetime 

    <script type="text/javascript">
    {
       window.alert("******")
    }
    </script>
</apex:page>

************************************Not Working*****************************
<apex:page standardController="case" >
    <script type="text/javascript">
    {
      window.document.onload = new function(e)
    {
      if({!case.Case_Age__c>10}) 

// when I use some other text field it genrates a alert(example case.status='New')

      {
        alert("**********");
      }
      else
      {
        alert("**********");
      }
    }
</script>

Please help me with this and tell me what am I missing.

Regards,
Ramandeep Singh
Nayana KNayana K
<apex:page standardController="case" >
    <script type="text/javascript">
      window.document.onload = new function(e)
		{
		  if('{!case.Case_Age__c}' >10}) 
		  {
			alert("*****if part*****");
		  }
		  else
		  {
			alert("****else part******");
		  }
		}
	</script>

</apex:page>

Can you please try this?
Ramandeep_SinghRamandeep_Singh
Hi Nayana,

Thanks for the reply. And it is still the same with no alert popup.

Regards,
Ramandeep