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
sriharisfdc reddysriharisfdc reddy 

visualforce page script

Original question:
hi friends
 I am created onee vf page in that i am created i am script 
like
<script>
 function show(){
  alert('...');
}
show i am called in Command Button

now my requirement is when pop up coms then i hav to create
alert box with this
do you want to resend email
     yes   no
if he clickss yes email should go
if he clicks no that reord sholud be updated
the vf page is for updation only
 in the vf i am taken two extensions
<apex:commandbutton action="{!Addrecord}" value="update"/>

no how could i write for send emails
in the controller sendemail() method is there 
☯ BonY ☯☯ BonY ☯
Hi,

try this below one
 
<apex:commandbutton onclick="return confirm('do you want to resend email?');" action="{!Addrecord}" value="update"/>
Thanks,
Boni
 
sriharisfdc reddysriharisfdc reddy
<apex:page Standardcontroller="Dealsheet__c" extensions="UpdtDealsheetController,ResendMailDealsheet" tabStyle="Dealsheet__c">
<apex:form >

  <script >
     
   function goPage(){
           
               if(confirm(' Do you want to  ResendEmail?  ')== true){
                Addrecord();
                getSendmail();
               }
             else{
                   Addrecord();}
   }
</script>
<apex:pageMessages />
 <style>
    .one td input[type="radio"]{
             float: left;
             margin-left: -1px;
             margin-top: -1px;
     }
 </style>
     
<apex:pageBlock title="Update DealSheet" mode="edit">
   <apex:pageBlockButtons >
    <apex:commandButton action="{!Addrecord}"  value="Update" onclick="goPage()"  />  
    </apex:pageBlockButtons>
     <apex:actionFunction action="{! getSendmail}" name="getSendmail" onComplete="alert('After apex method') ;"/>
 
but whenn i click update it showing one popo up if i click ok itss updating but it is not sending mail
 
sriharisfdc reddysriharisfdc reddy
 <script >
    
   function goPage(){
           if (confirm('Do you need to send email')== true)
           {
            alert('true');
            Addrecord();
            getSendemail();
            alert('true');
          }
          else
          {
              Addrecord();
              alert('false');
          }
   }
</script>
<apex:pageMessages />
 <style>
    .one td input[type="radio"]{
             float: left;
             margin-left: -1px;
             margin-top: -1px;
     }
 </style>
    <apex:form >
     <apex:actionFunction action="{! getSendmail}" name="getSendmail" immediate="true"   />
     <apex:actionFunction action="{!Addrecord}" immediate="true" name="Addrecord"   oncomplete="confirm('Resend Email');"/>
<apex:pageBlock title="Update DealSheet" mode="edit">
   <apex:pageBlockButtons >
    <apex:commandButton value="Update" action="{!Addrecord}" onclick="confirm('Are you sure?')" oncomplete="getSendmail()" />
     
   if i use this one updated email was sending but 2 pop ups are ccoming and if i press cancel button then agaain 2 pop ups coming and again updated email was ssending