Is there a way to create a custom field housed only in an individual form, not in Marketo at large?
An example would be a form for an event with a custom field for whether they want chicken or steak for dinner. We would want this custom field to only be available for use in that one form.
After a fashion, yes. I call this a flash field. The concept behind a flash field is to have information that is associated with the lead without having to create a new custom field. There are (at least) 3 approaches:
Hi Sanford,
Thank you for the suggestions to this question from Anna. We too want to track things like dietary requirements, etc. After reading through your suggestions, I am a bit confused about how to add the "flash field" (option 1) and what you mean by adding a rich text area that includes the "form widget" (option 2). Can you please clarify exactly how to add these items to the form? Thanks for your help!
Melissa
You will probably find [1] easier to set up. All you're doing is creating a field that can have a variable use, because you'll be prepending the current label (which you can customize in Form Editor) to the value when the form posts.
MktoForms2.whenReady(function(form){
form.onSubmit(function(form){
var formEl = form.getFormElem()[0],
fieldLabelEl = formEl.querySelector('LABEL[for="LastFlashField"]'),
flashKey = (fieldLabelEl.textContent || fieldLabelEl.innerText);
form.setValues({
LastFlashField : flashKey + '=' + form.getValues().LastFlashField
});
});
});
With this JS, if you set the label to "Favorite Food" and the user types "Pizza," the final value posted to Marketo is "Favorite Food=Pizza".
Thanks Sanford! So I tried adding the code to the CSS and nothing happened. From the form editor, where do I specifically go to add in this "flash field" and code? Do I need to add a field to the Field Details page first? Sorry for so many questions, I'm new to forms and coding.
You can't add this to the CSS! It's JavaScript, so it has to be in an HTML Element (assuming a Marketo LP) wrapped in script tags.
<script>
MktoForms2.whenReady(...
</script>