Expand my Community achievements bar.

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

Avatar

Former Community Member

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.

Anyone?

__________________________________________________________________________________________________________________________________

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

**************************************************************************************/

function

LockAllFields(myParentObject){

var allChildElements;

var intNumElements;

var currentElement;

var j;

var temp;

//Get all the child nodes of the parent element

allChildElements

= myParentObject.nodes;

//Total number of element in the object

intNumElements

= allChildElements.length;

//Loop through all the child elements

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

currentElement

= allChildElements.item(j);

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

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

LockAllFields(currentElement);

}

//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

temp

= currentElement.name;

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

currentElement.access

= "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

currentElement.access

= "readOnly";

}

}

}

}

}

//end function

5 Replies

Avatar

Level 2

How about putting

xfa.resolveNode("TextField16").access = "open";

after you call the 'LockAllFields' function?

Andy

Avatar

Former Community Member

Thanks Andrew...

I loaded version 8, and it has the 'Add Action' function which I'm tinkering with now. So, I'll hold the script you gave for later while I tinker with the new versions feature set... a new question comes to mind though, can I pull data or push data to/from an Excel spreadsheet using LC-ES2?

S.G.Warren

x4876

The thing about being human is, you cant see your future

until its your past, because it shapes your present~!

Avatar

Level 2

Hi swarren5,

You're welcome.

I don't know much about Excel with Acrobat but the guys over at PDF scripting do (they seem to know most things scripting).  See http://www.pdfscripting.com/public/department48.cfm for information.

HTH,

Andy

Avatar

Former Community Member

Excellent information - but I have to spend money~!

NOT HAPPENING... not on my dime. This is a government project, and money is tight... OH WELL~!

S.G.Warren

x4876

The thing about being human is, you cant see your future

until its your past, because it shapes your present~!

Avatar

Former Community Member

Andrew,

I'm wondering how to link a pdf document designed in LCES, to MS Excel, so that output from forms stored on a SharePoint Server, can be reviewed in an excel spreadsheet. The spreadsheet would be a document register if you will... have you any skill with doing something of this nature? I know it entail mapping fields on the form to columns on the spreadsheet, with XML, but building and adding the script into the form to actually do the exporting of data is proving to be quite the challenge.

Kindly reply when you have a minute.

Regards,

S.G. Warren

x4876

The thing about being human is, you can't see your future, until it's your past - because it shapes your present~!