Hi fellow Marketo experts, have you guys had any experience setting up pre-check for Marketo form checkboxes based on country selection on the same form? Or even pre-check in general, is it still feasible with Marketo's prefill policy upgrade (not directed by email click)?
Thanks in advance!
Solved! Go to Solution.
I refer to this as cascading values between source and target fields, as opposed to "pre-checking".
Key to the right UX is (typically) you flip the target checkbox automatically until the user interacts with it deliberately.
You don't want the source to keep controlling the target forever, because the target is still presented as if it's user-writable and you'll frustrate the end user if you keep undoing their changes! So you keep track of whether the checkbox was changed automatically or manually, and once it's been changed by the end user you let it stay put. In technical terms, this means you remove the event listener on the source field once they interact (whatever "interact" means, that too may need to be defined) directly with the target.
Then you also need to figure in Pre-Fill -- if the target starts out checked because it was filled from the person's existing record in your Marketo database, you don't want to start flipping it around then, either.
The JS in this CodePen considers the above requirements:
MktoForms2 :: Auto-cascade select → checkbox
You set the sourceField to the name of your select, targetField to the name of your checkbox. The rules array is your matching logic, what you want to do when the sourceField's value is/isn't found in the list of values.
Even so, this code doesn't cover every possible permutation. If I were working on this project, I'd make sure all possible cases are covered -- it's not something to just overhear and implement -- or else you're constantly getting new "bug" reports because it wasn't spec'd out completely.
Well, having form fields interact while you're interacting with a form doesn't have anything to do with Pre-Fill.
That is, if you select a Country and that checks/unchecks a corresponding Consent checkbox (though it's more traditional to hide/show such a checkbox) that's not using any stored data, it's all data provided by the lead.
Loading the person's previous selections, if they have an associated Munchkin session, is where Pre-Fill comes in, and that's completely doable with my JS code @ https://nation.marketo.com/groups/newyork-user-group/blog/2018/05/04/form-pre-fill-external-sites-no... Note this works for non-Marketo LPs as well (which is what is was originally for).
Sorry I mixed these two up. What I really need to figure out is whether I can pre-check the opt-in checkbox based on Country selection. Or is it possible to pre-check a checkbox field on Marketo form overall. Thank you Sanford!
I refer to this as cascading values between source and target fields, as opposed to "pre-checking".
Key to the right UX is (typically) you flip the target checkbox automatically until the user interacts with it deliberately.
You don't want the source to keep controlling the target forever, because the target is still presented as if it's user-writable and you'll frustrate the end user if you keep undoing their changes! So you keep track of whether the checkbox was changed automatically or manually, and once it's been changed by the end user you let it stay put. In technical terms, this means you remove the event listener on the source field once they interact (whatever "interact" means, that too may need to be defined) directly with the target.
Then you also need to figure in Pre-Fill -- if the target starts out checked because it was filled from the person's existing record in your Marketo database, you don't want to start flipping it around then, either.
The JS in this CodePen considers the above requirements:
MktoForms2 :: Auto-cascade select → checkbox
You set the sourceField to the name of your select, targetField to the name of your checkbox. The rules array is your matching logic, what you want to do when the sourceField's value is/isn't found in the list of values.
Even so, this code doesn't cover every possible permutation. If I were working on this project, I'd make sure all possible cases are covered -- it's not something to just overhear and implement -- or else you're constantly getting new "bug" reports because it wasn't spec'd out completely.
OP please return to the thread and check responses.