Hidden Fields on Forms 2.0

Anonymous
Not applicable

Hidden Fields on Forms 2.0

I am trying to create a hidden field on Forms 2.0 however the tricky part is getting it to populate only when a certain value is selected. So for instance we ask who are you requsting this information for 'Yourself or Your Child' if they they choose myself the automatic flow works properly but if they choose Your Child I need a hidden Segment field to populate with 'Pediatric' but only if they choose "Your Child". Is there an easy way to do this or do I have to create a smart campaign to update this field in Salesforce. Let me know if anyone has any ideas Thanks!
Tags (1)
2 REPLIES 2
Kenny_Elkington
Marketo Employee

Re: Hidden Fields on Forms 2.0

Hey Jessica,

You'll need to implement some custom code to do this using the forms 2.0 API(http://developers.marketo.com/documentation/websites/forms-2-0/).  It would look something like this:

MktoForms2.onValidate( function(form){
var vals = form.getValues();
if (vals.yourValue = thisValue){ //check the submitted values here
form.addHiddenFields({ "newField" : "newValue"}); //add conditional values here
} //iterate with 'else if' here if necessary
}
)
Anonymous
Not applicable

Re: Hidden Fields on Forms 2.0

Jessica,

Kenny's method would likely work, but the easiest way to do this would be to create a smart campaign that listens for that selection to change the value to "Pediatric."