1

I have two Javascript functions:

<script>

function confirmTransfer() {
  var tasks = "{!totalTasks}";
  var matches = "{!totalMatches}";
  var contacts = "{!totalContacts}";

  var transfer = confirm("Are you sure you wish to transfer: " + 
    tasks + " tasks, " + matches + " matches, and " + contacts " contacts?");

  if (transfer) return true;
  return false;
}  

function confirmCancel() {
  var isCancel = confirm("Are you sure you wish to cancel?");
  if (isCancel) return true;

 return false;
}
</script>

for some reason, just the confirmCancel function does what I want it do. The confirmTransfer button simply goes sstraight to the function call in the commandButton:

<apex:commandButton action="{!cancel}" value="Cancel" 
onclick="return confirmCancel()"immediate="true"/>    
<apex:commandButton action="{!step4}"  value="Transfer" 
onclick="return confirmTransfer()" immediate="true"/>

When I click Transfer, I see this in the console: transfercontacts:137 Uncaught ReferenceError: confirmTransfer is not defined

The syntax is the same, can anyone explain what this could be?

Thanks in advance!

4

It looks like you are missing a + here:

contacts + " contacts?"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.