Hi guys,
Is there a way to stop a hidden field on a form from prepopulating when a certain value is selected? I'm essentially looking to replicate the way the visibility rules will hide a field, for example, a form has Country and State; if Canada is selected, hide the State field.
Can you do something similar with a hidden field? The hidden field I'm trying to block prepopulates with a timestamp - I want this timestamp not to pass through if a certain value is selected in the form.
Thanks
Natali
Hi Natali,
You will have to use some Javascript to do this.
-Greg
MktoForms2.whenReady(function(form){
form.onSubmit(function(form){
if ( form.getValues()['YourVisibleFieldName'] == 'YourCertainValue' ) {
form.setValues({
'YourHiddenFieldName' :null
});
}
});
});
Thanks so much. I'll give it a go