Forms: Field visibility rules on a hidden field

Highlighted

Forms: Field visibility rules on a hidden field

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

Tags (1)
3 REPLIES 3
Highlighted

Re: Forms: Field visibility rules on a hidden field

Hi Natali,

You will have to use some Javascript to do this.

-Greg

Highlighted
Level 10 - Community Moderator

Re: Forms: Field visibility rules on a hidden field

MktoForms2.whenReady(function(form){

  form.onSubmit(function(form){

    if ( form.getValues()['YourVisibleFieldName'] == 'YourCertainValue' ) {

      form.setValues({

        'YourHiddenFieldName' :null

      });

    }

  });

});

Highlighted

Re: Forms: Field visibility rules on a hidden field

Thanks so much. I'll give it a go