You need to sign in to do that
Don't have an account?

window.confirm not working
Don't know when this stopped working but it was working and now not. I have the following code:
apex:tab label="Contacts" name="contactList">
<apex:pageBlock title="Contacts" id="contact_list">
<apex:pageBlockTable value="{!RelatedContactsList}" var="CO">
<apex:column headerValue="Action">
<apex:commandLink action="{!DeleteDLContact}" reRender="contact_list" onclick="window.confirm('Are you sure?');">
<b>Del</b>
<apex:param name="dlcontactid" value="{!CO.Id}" assignTo="{!DeleteDLContactID}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!CO.Contact__r.LastName}, {!CO.Contact__r.FirstName}" headerValue="Name"/>
<apex:column value="{!CO.Contact__c}"/>
<apex:column value="{!CO.Contact__r.Email}"/>
<apex:column value="{!CO.Contact__r.AccountId}"/>
</apex:pageBlockTable>
<apex:outputLink value="/apex/DistributionListContacts?dl={!id}" rendered="{!ContactListHasMore}">Show more »</apex:outputLink>
</apex:pageBlock>
</apex:tab>
When "Del" link is clicked the action method "DeleteDLContact" is called not matter whether OK or Cancel is clicked on the "Are you sure?" confirmation.
I have tried changing the onclick to onclick="return window.confirm('Are you sure?');" but this results in the action method not being called at all. This definately was working, I can't work out what has changed to stop it working.
Any ideas? Thanks.
There's some hits on google about onclick not behaving correctly under vista.
It may be that the return is confusing the browser (although it shouldn't). Try changing your onclick handler to only return a value if the confirm returns false. Something like:
if (!window.confirm('Are you sure?')) return false;
All Answers
There's some hits on google about onclick not behaving correctly under vista.
It may be that the return is confusing the browser (although it shouldn't). Try changing your onclick handler to only return a value if the confirm returns false. Something like:
if (!window.confirm('Are you sure?')) return false;
I use Firefox for development and it was working... (yes, I'm beginning to doubt myself now!) it's always disconcerting when something changes without knowing the what and why. But your suggestion works perfectly, thanks for that Bob.