korbo
korbo

Reputation: 1

Eloqua Forms: how to show/hide fields depending on others fields

Eloqua Forms

I want to know if there is some way to show or hide fields (or sections) depending on what values of others fields.

Of course, I am asking on some OOTB behavior; if not, will do it with JS.

Thanks in advance.

Upvotes: 0

Views: 2058

Answers (2)

Bryan Joseph Myers
Bryan Joseph Myers

Reputation: 317

You would need a listener (onchange in example).

Eloqua uses dynamic ids for form field elements based upon order. Setting the "HTML Name" value for the fields in the form editor allows for a more stable reference.

var fieldToListenTo = document.getElementsByName('eloquaHTMLName1')[0];
var fieldToChange = document.getElementsByName('eloquaHTMLName2')[0];

fieldToListenTo.onchange = function(){
  if(fieldToListenTo == 1) {
    fieldToChange.value = "New Value 1";
  }
  else {
    fieldToChange.value = "New Value 2";
  }
}

Upvotes: 0

user1234567
user1234567

Reputation: 61

Unfortunately, Eloqua does not have a conditional rules for form field visibility (at least not yet. Dependent Field Visibility/Logic).

Until that functionality is brought into Eloqua Forms, you would have to write some Javascript to accomplish this.

Upvotes: 0

Related Questions