In a form i have almost 20+ fields with value of Field ID having the pattern &qu

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

  • 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;
    }
    }
    }
  • 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))