Guest User

Untitled

a guest
Feb 11th, 2016
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function validateAndSubmit(dummy_form){
  2.     var valid = true;
  3.     if( !validator.checkAll( dummy_form ) ) {
  4.         valid = false;
  5.         console.log('validation failed');
  6.     }
  7.     if( valid ) {
  8.         console.log('validation success');
  9.         MktoForms2.loadForm("//app-sj16.marketo.com", "825-DUM-524", 1038, function(form){
  10.             form.vals({
  11.                 'FirstName': dummy_form['First Name'].value,
  12.                 'LastName': dummy_form['Last Name'].value,
  13.                 'Email': dummy_form['Email Address'].value,
  14.                 'Phone': dummy_form['Phone Number'].value,
  15.                 'Company': dummy_form['Company Name'].value,
  16.                 'Website': dummy_form['Website'].value
  17.             });
  18.             form.onSuccess(function(values, followUpUrl) {
  19.                 // prevent redirect to any followup URL
  20.                 console.log('form submitted');
  21.                 return false;
  22.             });
  23.         });
  24.         MktoForms2.whenReady(function (form) {
  25.             console.log(form);
  26.             console.log(form.vals());
  27.             form.submit();
  28.         });
  29.     }
  30. }
RAW Paste Data