Skip to content

Instantly share code, notes, and snippets.

@pmgllc
Created January 10, 2014 15:43
Show Gist options
  • Save pmgllc/8356675 to your computer and use it in GitHub Desktop.
Save pmgllc/8356675 to your computer and use it in GitHub Desktop.
When do you run this on a page/form to split the name field before it posts to Infusionsoft?
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('#Submit').click(function() {
var splitName = jQuery('#Contact0FirstName').val();
var names = splitName.split(' ');
var firstName = names.splice(0,1);
var lastName = names.join(' ');
jQuery('#Contact0FirstName').val(firstName);
jQuery('#Contact0LastName').val(lastName);
jQuery('form').submit();
return true;
});
});
</script>
@mpeshev
Copy link

mpeshev commented Jan 10, 2014

did you try to alter line 3 to:

jQuery('#Submit').click(function(e) {

and add right below that:

e.preventDefault();

@pmgllc
Copy link
Author

pmgllc commented Jan 10, 2014

Hmm, thanks. I'll try.

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