Looking for some answers? You're in the right place!

Beata Wertepna
Written by Beata Wertepna

Using LiveCall with contact forms

You can attach LiveCall to you website form so that anytime someone provides a phone number, LiveCall will automatically connect you with this user.


There are two ways the for integration can be done:

Method 1: HTML Attribute

When you add the following attribute to the phone input element in your form: 

data-livecall-role="callback-phone-number-input", 

we will observe the form's submit event and automatically submit the callback to our servers.

The resulting input should look similarly to this:

<input type="tel" name="phone-number" data-livecall-role="callback-phone-number-input" />

However this solution might not always be ideal. If you're form is handled by some JavaScript code, of if you have validation and don't want to submit the callback before you're sure that the data in the form is valid, you should consider the second method.

Method 2: JavaScript

If your form is handled by JavaScript or it needs to be validated before submitting the callback, you should integrate the form using JavaScript. To do that, when you're ready to submit the form, call the 

livecallClient.submitCallback() 

method. Like this:

livecallClient.submitCallback($("input[name=phone-number]").val());

Replace the

$("input[name=phone-number]").val() 

part with an appropriate code for retrieving the phone number from your form.

Categories: