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

How do I hide fields based on their name (using a loop)?

$
0
0

I have a form that will require several fields to be hidden when the user first loads the form. I would like to automate that with a JavaScript loop where if the object name starts with "hid" set its presence to "hidden".

I found the script below in the LiveCycle ES4's documentation but it does nothing. No errors were reported in the JS console. Which event should the loop be added to? Of the parent form? Is the syntax correct for what I am trying to achieve?

 

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {    var oFields = xfa.layout.pageContent(nPageCount, "field");    var nNodesLength = oFields.length;    for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {        if (oFields.item(nNodeCount).name.substring(0,3) == "hid") {            oFields.item(nNodeCount).name.presence = "hidden"        }    }
}

 

Thanks!


Viewing all articles
Browse latest Browse all 5571

Trending Articles



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