Hi All,
We are using custom fields in Marketo form ( CustomFieldA, CustomFieldB)
CustomFieldA assigned single checkbox and CustomFieldB assigned multiple checkboxes
Like below image
I would like to submit the form as CustomFieldB = NULL (empty the field) if user checks only CustomFieldA and not CustomFieldB
Here is my code but it is not working. Please let me know how to make this work.
$(document).ready(function() {
MktoForms2.whenReady(function(form) {
form.onSubmit(function(form) {
var vals = form.vals();
var giveaway = vals.CustomFieldA;
var assets = vals.CustomFieldB;
if(giveaway == "yes" && typeof assets === "undefined"){
form.setValues({"CustomFieldB":"NULL"});
}else if(giveaway == "no" && assets != ""){
form.setValues({"CustomFieldA":"NULL"});
}
});
});
});
Solved! Go to Solution.
Two problems here:
Two problems here: