Hi - I am looking for direction on how I would go about disabling a form field based on another fields value. I do not want to hide the filed, just disable it..possibly gray it out. I assume I would need some JS..
Yes, listen for the input event (in this case you must use DOM events, there's no Forms 2.0 event for this). Can't show you more if you don't have the form built.
Sanford - I appreciate your response. I have the form on a test page here: http://pages.wheelsup.com/MT-TEST.html
I am looking at the 'Membership Type' field. The logic I am trying to achieve is to disable the 'Wheels Up Business Membership' checkbox if 'Wheels Up Connect Membership', 'Wheels Up Core Membership' or a combo of both is selected. Essentially only allowing Business to be selected by itself.
This isn't really interdependent fields, then.
It's interdependent checkboxes within the same checkbox group.
A specific implementation of this is easy, but abstracting the concept isn't. See the JS on
Hi Benjamin,
As suggested by Sanford, you need to put action on input event. Here is the sample script:
<script>
// <![CDATA[
MktoForms2.whenReady(function (form) {
var x = document.getElementById("MainField");
x.addEventListener("blur", myBlurFunction, true);
function myBlurFunction() {
var y = document.getElementById("DependentField");
var mainFieldValue = x.value;
if(mainFieldValue=="Test")
{
document.getElementById("DependentField").disabled = true;
}
} // ]]></script>
Thanks