5 Replies Latest reply on Jun 15, 2011 9:53 AM by swarren5

    Need assistance with tweaking a JavaScript for a form...


      In the script below, designed to lock all fields of a form; I need to tweak it so that if a specific option (Enterprise), is chosen from a DropDownList, every field in the form except TextField16 is automatically locked for editing, along with the Button functions that are already coded as exceptions in this script.  I am not a programmer, and the kind assistance from a member of this forum who gave me this script, will not be available for the next 6 weeks while he is on vacation.



      __________________________________________________________________________________________ ________________________________________


      form1.#variables[0].myScriptObject - (JavaScript, client)





      Function: LockAllFields

      Description: This function will lock all fields.

      IN: The parent subform. It could also be an element that contains subform like form1

      OUT : nothing







      var allChildElements;


      var intNumElements;


      var currentElement;


      var j;


      var temp;



      //Get all the child nodes of the parent element



      = myParentObject.nodes;


      //Total number of element in the object



      = allChildElements.length;



      //Loop through all the child elements



      for(j=0; j< intNumElements;j++){


      = allChildElements.item(j);


      //If the element is another subform we'll recusively call the function again



      if(allChildElements.item(j).className == "subform"){




      //If the objects are fields and they are set to mandatory (validate.nullTest) then we will set the border.fill.color - dependant on object type



      else if(currentElement.className == "field"){


      //CHeck to see if the field is a button - do not lock buttons



      = currentElement.name;


      if (temp.substring(0,6) != "Button"){


      = "readOnly";





      //Check for exclusion groups - Radio Buttons



      else if(currentElement.className == "exclGroup"){


      for(k=0; k< currentElement.nodes.length;k++){


      if(currentElement.nodes.item(k).className == "field"){


      //set the color for the radio buttons individually



      = "readOnly";







      //end function