Dynamically changing form fields? | Community
Skip to main content
September 16, 2014
Question

Dynamically changing form fields?

  • September 16, 2014
  • 2 replies
  • 1160 views
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?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Josh_Hill13
Level 10
September 16, 2014
You could use the Known Lead option, although that will remove the Form.
September 17, 2014
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>