Skip to content

Instantly share code, notes, and snippets.

@kdipaolo
Last active April 24, 2018 15:32
Show Gist options
  • Save kdipaolo/5a5ffd44349198aac5d154fc894d1835 to your computer and use it in GitHub Desktop.
Save kdipaolo/5a5ffd44349198aac5d154fc894d1835 to your computer and use it in GitHub Desktop.
Intercom Form
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script>
document.addEventListener("DOMContentLoaded", function (event) {
var form = document.querySelector('#intercom_form')
form.addEventListener('submit', e => {
e.preventDefault()
var email = document.querySelector('#email').value
var name = document.querySelector('#name').value
var phone = document.querySelector('#phone').value
// Will need to merge in latest PR in order for a new user to be created in intercom at app.bidlikeaboss.com
window.location.href = `https://app.bidlikeaboss.com/?i_name=${name}&i_email=${email}&i_phone=${phone}`
})
});
</script>
</head>
<body>
<form id="intercom_form">
Name:
<br>
<input type="text" name="name" id="name" placeholder="">
<br> Email:
<br>
<input type="email" name="email" id="email" placeholder="">
<br> Phone:
<br>
<input type="phone" name="phone" id="phone" placeholder="">
<br>
<button type="submit">Add User</button>
</form>
</body>
</html>
@marktiderman
Copy link

marktiderman commented Apr 24, 2018

@kdipaolo Can you incorporate this from Instapage?

<script>
window.instapageFormSubmitSuccess = function( form )
{
// get values from form fields

var param1 = ijQuery( form ).find( 'input[name="'+ base64_encode( 'Name' ) +'"]').val();
var param2 = ijQuery( form ).find( 'input[name="'+ base64_encode( 'Email' ) +'"]').val();
var param3 = ijQuery( form ).find( 'input[name="'+ base64_encode( 'Company' ) +'"]').val();

// Get the actual redirect url

var redirect_url = ijQuery( form ).find( 'input[name="redirect"]' ).val();

// Amend redirect url in form by adding fields from form

ijQuery( form ).find( 'input[name="redirect"]' ).val( redirect_url + '?name='+ param1 + '&email='+ param2 + '&company=' + param3);
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment