adding state to autofill
This commit is contained in:
parent
6a0f231d1f
commit
18a5425588
@ -4,6 +4,7 @@
|
||||
iframeHolderDiv = document.createElement('div'), // so we can style location of button
|
||||
autoFillLocation = document.querySelector("form[id^='mktoForm_']"), // will only find first Marketo form on a page
|
||||
firstRow = document.querySelector('form .mktoFormRow'),
|
||||
mktoForm,
|
||||
hiddenLinkedInInputs = document.createDocumentFragment(), // since we're creating multiple nodes, just do the add once
|
||||
hiddenInputCreator = function (tagName, onChangeHandler) {
|
||||
var newInput = document.createElement('input');
|
||||
@ -262,10 +263,15 @@
|
||||
mktoCountryInput = document.querySelector("#Country");
|
||||
// sets the value in the form the user can see
|
||||
if (typeof MktoForms2 !== 'undefined') {
|
||||
MktoForms2.allForms()[0].setValues({
|
||||
mktoForm.setValues({
|
||||
'Country': countries[newValue.toUpperCase()]});
|
||||
}
|
||||
});
|
||||
hiddenInputCreator('state', function(newValue){
|
||||
mktoForm.setValues({
|
||||
'State': newValue.toUpperCase();
|
||||
});
|
||||
});
|
||||
|
||||
/*['email', 'country'].forEach(function(inputField){
|
||||
var newInput = document.createElement("input");
|
||||
@ -307,6 +313,7 @@
|
||||
// need the id of the form so we can hook up autofill
|
||||
// doing this way will work on any Marketo form
|
||||
fillScript.setAttribute('data-form', 'mktoForm_' + form.getId());
|
||||
mktoForm = form;
|
||||
form.onSubmit(function (form) {
|
||||
console.log('onSubmit');
|
||||
console.log(form.vals());
|
||||
|
Loading…
Reference in New Issue
Block a user