we have a form with a multi Picklist field and will have a validation message that says "Please select at least one". The problem is that it is not a required field and we are putting this message because we just want to instruct the registrants to select one before submitting. The validation message should disappear if the multi picklist is hidden.
I would like to ask if this is possible in Eloqua?
I created the following JavaScript code:
var multipleSelectMenu = document.getElementsByClassName(`multipleSelectMenu`); //checkbox items //create a validation message element var validationMessage = document.createElement(`div`); validationMessage.classList.add(`validation-message`); validationMessage.textContent = `Please select at least one item.`; //add the validation message element to the body of the document document.body.appendChild(validationMessage); //select all checkboxes for (var i = 0; i 0){ document.getElementById("submit").disabled = false; validationMessage.style.display = `none`; } else{ document.getElementById("submit").disabled = true; validationMessage.style.display = `block`; } }); } var multipleSelectMenu = document.getElementsByClassName(`multipleSelectMenu`); //checkbox items //create a validation message element var validationMessage = document.createElement(`div`); validationMessage.classList.add(`validation-message`); validationMessage.textContent = `Please select at least one item.`; //add the validation message element to the body of the document document.body.appendChild(validationMessage); //select all checkboxes for (var i = 0; i 0){ document.getElementById("submit").disabled = false; validationMessage.style.display = `none`; } else{ document.getElementById("submit").disabled = true; validationMessage.style.display = `block`; } }); }I expected it to create a paragraph message that will be the validation message but it made the whole multipicklist disappear instead.