質問

I am having some issues with getting a confirmation dialog to show up using an onClick. Is there an easier way to get around this? Perhaps using an actionFunction? My delete function works if I do not have the onClick. However, with the onClick, the dialog does not pop up, nether does the function fire. Not getting any logs on the dev console or any errors on the javascript console

<apex:pageBlockTable value="{!qualifications}" var="p" id="thePanel">  

<apex:column styleClass="actionColumn">
   <apex:facet name="header" ><apex:outputText value="  {!$Label.Action}" /></apex:facet>                                                              
   <apex:commandLink action ="{!del}" rerender="thePanel"  onclick="return confirm('are you sure?');" value="{!$Label.Delete}" >
     <apex:param name="delid" value="{!map[p].qual.Id}" />
  </apex:commandLink> 
</apex:column>     

//controller delete

 public PageReference del() {
          try {
            String delid = getParam('delid');
            Member__c qual = [SELECT Id FROM Member__c WHERE ID=:delid];
            DELETE qual;
            requery();
          } catch (Exception e) {
            ApexPages.addMessages(e);
          }
          return null;
        }
役に立ちましたか?

解決

Change to

onClick="if(!confirm('are you sure?'))return;"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top