Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
2 replies
Subscribers
6 subscribers
Views
1156 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
In a form i have almost 20+ fields with value of Field ID having the pattern &qu
ramakg
A Score Level 1
over 13 years ago
In a form i have almost 20+ fields with value of Field ID having the pattern "fldProposal_"; When the form loads, instead of writing 20+ javascript statements that disable each field, any idea how to write a general purpose code that loops through all the 20 fields and disables each?...
OriginalPostID-30653
OriginalPostID-30653
Discussion posts and replies are publicly visible
0
Eduardo Fuentes
Appian Employee
over 13 years ago
You can use a similar approach to what I posted here
forum.appian.com/.../3518
on Dec 15, 2011.
If all your fields have an ID (given in the FORMS DESIGNER not in the DOM itself) that follows a naming convetion you can do something like this:
function toggleEnabledFlag(prefix,fieldsToDisableArray){
for(var i = 0; i < fieldsToDisableArray.length; i++){
var componentDom = window.Build.util.getComponentContainer(prefix + fieldsToDisableArray[i], window.FormDesigner.runtimeNamespace);
if (componentDom.length > 0) {
componentDom.get(0).disabled=true;
}
}
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 13 years ago
See how I "dynamically" build the ID of the component and I pass it to the getComponentContainer function. You can call this function in the load event of your form; assuming the text fields have an id of type: myfield1, myfield2, this is the way to disable these two fields:
toggleEnabledFlag("myField",new Array(1,2))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel