Is there any way to dynamically pass values to liveagent.addCustomDetail
method?
When I use document.getElementById('email').value
instead of text in the customdetail
method the Chat button disappears and when I replace it with text it reappears.
<script type='text/javascript'>
liveagent.CustomDetail('Contact E-mail', 'jane@doe.com');
//how to dynamically pass email value from form
</script>
<form>
<!-- Detail inputs -->
<p>First Name:</p><input type="text" id="firstName" /><br />
<p>Last Name:</p><input type="text" id="lastName" /><br />
<p>Email:</p><input type="text" id="email" /><br />
</form>
Best Answer
Yes you can do that. You have to update the Salesforce generated code as below. Only one issue user has to disable pop-up blocker.
Salesforce generated code.
Updated code