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
lewislewis 

pop up alert

can someone help with a popup alert in a custom object once a checkbox box field is ticked .

i am looking to ask the user if they really want to tick the field .

 

devendra dhakadevendra dhaka

Lewis you can call a javascript method when checkbox is checked.

 

onClick event will do the work for you.

lewislewis

is there any simpler way as i do not know javascripts

BewitchedBewitched

Hi,

 

Using a Java Script would be an easier way out..This is an example that would show you how to do it..

 

Use a checkbox and give an ID to it for ex:-

 

<apex:inputCheckbox id="Chkbox11" />

 

Now use a Java ecript to call this ID..

 

Include the following function in your VF page:-

 

<Script>
function ShowAlert()
{
 var busamval = document.getElementById('pagelist:form1:selectionBlock:Chkbox11');
if(busamval.checked == false)
{
 alert('Alert Message');
}

}
</Script>

 

Try and see if you can use Validation Rules to display messages..instead of Java Script

 

Thanks,

Tulika

 

 

lewislewis

thanks tullika .

 

a validation rule doesnt work . as all i need is a popup to advise the user that the checkbox is ticked and once they click ok, they can save the record

BewitchedBewitched

Lewis, in that case try the java script I have posted in my previous message..

 

lewislewis

i created the VF page as you suggested.

 

<apex:page standardController="Waiver_Favor__c">
  <Script>
function ShowAlert()
{
 var busamval = document.getElementById('pagelist:form1:selectionB​lock:Final_Approver__c');
if(busamval.checked == false)
{
 alert('Are you sure you want to use your Quota');
}

}
</Script></apex:page>

 

 

 what would be the next step then

LakshmanLakshman

you can do it as below:

 

 

<apex:page standardController="Waiver_Favor__c">
  <Script>
function ShowAlert()
{
 var busamval = document.getElementById('pagelist:form1:selectionB​lock:Final_Approver__c');
if(busamval.checked == false)
{
 if(confirm('Are you sure you want to use your Quota'))
{
//place logic for yes
}
else
{
//set checked to true
busamval.checked=true;
}
 } } </Script>
</apex:page>

I suppose you have the page well formed like you have a form with check box present in it. Let me know if it works. Thank you!

 

Regards,

Lakshman

lewislewis

hi laksman ..

 

i have setup the page as you suggested . there is a checkbox field in the main page layout that needs to be ticked .

 

think i am missing something . is there a trigger or something that needs to be created that will trigger this popup  when i check the checkbox field ?

 

pls help.

lewislewis

pls check the code again as it seems we missd something. when i paste the page link to check out the popup . it opens in accounts with a blank page and not in the custom object we want the popup to open ?

 

https://c.cs2.visual.force.com/apex/test