Dynamically changing form fields?

Anonymous
Not applicable

Dynamically changing form fields?

Is there a way to dynamically limit the number of form fields on a form based on a URL? Progressive profiling is enabled on this particular form, but I'm trying to figure out a way to make the form shorter for specific visitors to the landing page without creating a whole new landing page and form (client wants the barrier to be lower for specific partner customers). My only thought is that somehow a URL parameter might work. 

Very limited experience with Java, unfortunately. 

Is this possible?
Tags (1)
2 REPLIES 2
Josh_Hill13
Level 10 - Champion Alumni

Re: Dynamically changing form fields?

You could use the Known Lead option, although that will remove the Form.
Anonymous
Not applicable

Re: Dynamically changing form fields?

You can try the whenReady method in the Forms2 API

The example below will hide the FirstName and LastName input fields.

To use replace the Url_Path_Value, and the input ids of the fields you would like to not display
 
<script>
 MktoForms2.whenReady(function(){
        if(window.location.href == ''Url_Path_Value')'){
            var hideInputs =  document.querySelectorAll('input#FirstName, input#LastName');
 
            for(i=0;i<hideInputs.length;i++){
                hideInputs[i].parentNode.parentNode.style.display = 'none';
            }
 
        }
    });
</script>