Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Radio buttons fail to call a function... why?

$
0
0

Hello Everyone,

I am working on complex form that will require a lot of show/hide fields based on user input. I am trying to automate the behavior with a JavaScript function placed at the parent form level. In fact I already have a couple functions there and they work great. The one below is a mystery. If both function and function calls are placed in the same object (radio group) everything works great. The moment I move the function to my parent form script object nothing works. Any ideas what I am missing?

Thanks,

Raquel

 

XMP.ApplicantForm.#variables[0].toggleOptComment


// Hide/Show fields based on field name prefix (substring)
// sectionName = parent subform to hide/show fields (search range)
// endPosition = integer, position of last character to be searched in field name (initial position is always zero)
// prefixString = substring to find in field name
// presenceValue = "visible" or "hidden"

function toggleFields(sectionName,endPosition,prefixString,presenceValue) {

        var oFields = sectionName.nodes;        var nNodesLength = oFields.length;         for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {            if (oFields.item(nNodeCount).name.substring(0,endPosition) == prefixString) {                oFields.item(nNodeCount).presence = presenceValue;        }    }
}


XMP.ApplicantForm.S9.S9-Radio::change - (JavaScript, client)


/* Submit Section 9.1 */
if (this.rawValue == "Yes") {    // Show these:    toggleFields(this.parent,2,"S9","visible");    // Hide these:    toggleFields(this.parent,4,"S9_2","hidden");    }
/* Submit Section 9.1 */
if (this.rawValue == "No") {    // Show these:    toggleFields(this.parent,4,"S9_2","visible");    // Hide these:    toggleFields(this.parent,2,"S9","hidden");    }

Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>