and here is my button config which is i'm already add my VFP pages on it and one thing, when i looked into browser console i get this message info, is it related? thanks in advance.",
"answerCount": 2,
"upvoteCount": 0,
"datePublished": "2021-05-18T02:51:00.000Z",
"author": {
"@type": "Person",
"name": "Admin Sys Admin HO",
"url": "https://trailblazers.salesforce.com/profileView?u=0054S000001INL9QAO",
"affiliation": {
"@type": "Organization",
"name": "UT"
}
},
"suggestedAnswer": [
{
"@type": "Answer",
"text": "Hi Ahmad, I could catch that the input submit from your pre-chat code is missing an action attribute like onclick=\"functionName()\". You would need to give the function name, which you want to call on click on 'Click to Chat' button. Please refer to code example given on this link ( https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_pre_chat_forms_code_sample.htm ) to understand it better. Hope above information helps, Please mark as Best Answer so that it can help others in the future. Thanks.",
"upvoteCount": 0,
"url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T49ZdSAJ",
"datePublished": "2021-05-18T07:03:13.000Z",
"author": {
"@type": "Person",
"name": "Shivankur Naikwade",
"url": "https://trailblazers.salesforce.com/profileView?u=0053A00000F0zJLQAZ",
"affiliation": {
"@type": "Organization",
"name": "--"
}
}
}
]
}
}
Skip to main content
Hello Community,currently i'm still develop a custom pre-chat for my org, and i have a problem in here.here is my custom pre-chat i've createdwhenever i tried to submit "click to chat" button, it doesn't connect to an agent instead it just refresh the page am i missing something in here?For reference here is my pre-chat code ;<apex:page > <script type='text/javascript'> (function() { function handlePageLoad() { var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&⌗]*)"); document.getElementById('prechatForm').setAttribute('action',decodeURIComponent(endpointMatcher.exec(document.location.search)[1])); } if (window.addEventListener) { window.addEventListener('load', handlePageLoad, false); } else { window.attachEvent('onload', handlePageLoad, false);}})();</script> <h1>Pre-Chat Form</h1> <!-- Form that gathers information from the chat visitor and sets the values to Chat Custom Details used later in the example --><form method='post' id='prechatForm'> First name: <input type='text' name='liveagent.prechat:LiveChatTranscriptFirst_Name__c' id='firstName' /><br /> Last name: <input type='text' name='liveagent.prechat:LiveChatTranscriptLastName' id='lastName' /><br /> Unit Model: <input type='text' name='liveagent.prechat:LiveChatTranscriptUnit_Model__c' id='unit_model' /><br /> Serial Number: <input type='text' name='liveagent.prechat:LiveChatTranscriptSerial_Number__c' id='serial_number' /><br /> <input type="hidden" name="liveagent.prechat.name" id="prechat_field_name" /> <input type='submit' value='Click to Chat' id='prechat_submit' /> <input type= "hidden" name="liveagent.prechat.findorcreate.linkToEntity:Account" value="Case,AccountId" /><style type="text/css">p {font-weight: bolder }</style> </form></apex:page>and here is my button config which is i'm already add my VFP pages on itand one thing, when i looked into browser console i get this message info, is it related?thanks in advance.
Hi Ahmad,I could catch that the input submit from your pre-chat code is missing an action attribute like onclick="functionName()". You would need to give the function name, which you want to call on click on 'Click to Chat' button.Please refer to code example given on this link (https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_pre_chat_forms_code_sample.htm) to understand it better.Hope above information helps, Please mark as Best Answer so that it can help others in the future.Thanks.