These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

lines color does not remain the same on reopen

oksana77
Registered: Apr 24 2009
Posts: 89
Answered

I am inserting red lines in the following code when a button is pressed, and it works. However, none of the red lines are there when I reopen the form. What is the problem?

form1.page1.sub1.rows.N1::click - (JavaScript, client)

if(xfa.resolveNode("rl.value.line.edge.color").value == "0,0,0")
{
xfa.resolveNode("rl.value.line.edge.color").value = "255,0,0";
xfa.resolveNode("rl.value.line.edge.thickness").value = "0.0035in";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].carrierName").borderColor = "255,0,0";
}
else
{
xfa.resolveNode("rl.value.line.edge.color").value = "0,0,0";
xfa.resolveNode("rl.value.line.edge.thickness").value = "0.0035in";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].carrierName").borderColor = "0,0,0";
}

My Product Information:
Acrobat Standard 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The changes you are making are not persistent. A LiveCycle PDF is composed of two thing, a form template and a data model. The form template is what you design in LiveCycle Designer. It is not the form, It's the template on which the form is created. You can also design the data model in LiveCycle, but by default the data model parallels the field hiearchy of the template.

When Acrobat loads the LiveCycle PDF it merges the data model into the template to create the real form the user sees on the screen, called the Form Model. When the form is submitted or saved, the data in the Form Model is saved back into the data model. Each of these components is represented by a SOM path. For example the template is "xfa.template", the data model is "xfa.datasets", the form model is "xfa.form". In LiveCycle scripting the Form model is the default. The only changes made to the form model that are sticky are changes to data. nothing else will matter. It's possible to make some kinds of changes to the template, but not from Reader. The whole idea is that data drives the system.

If you want to make persistent changes you have to somehow link them to the data, and setup initialization code that recreates the features you want on startup.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

oksana77
Registered: Apr 24 2009
Posts: 89
Thanks!

Here is the code that works:)

form1.page1.sub2.buttons.N1::click - (JavaScript, client)

if(this.rawValue == 1)
{
this.rawValue = 0;
xfa.resolveNode("form1.page1.rl" + this.parent.index).presence = "visible";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].bl.value.line.edge.color").value = "255,0,0";
}
else
{
this.rawValue = 1;
xfa.resolveNode("form1.page1.rl" + this.parent.index).presence = "hidden";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].bl.value.line.edge.color").value = "0,0,0";
}

form1.page1.sub2.buttons.N1::initialize - (JavaScript, client)

if(this.rawValue == 1)
{
this.rawValue = 1;
xfa.resolveNode("form1.page1.rl" + this.parent.index).presence = "hidden";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].bl.value.line.edge.color").value = "0,0,0";
}
else if (this.rawValue == 0)
{
this.rawValue = 0;
xfa.resolveNode("form1.page1.rl" + this.parent.index).presence = "visible";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].bl.value.line.edge.color").value = "255,0,0";
}
else
{
this.rawValue = 1;
xfa.resolveNode("form1.page1.rl" + this.parent.index).presence = "hidden";
xfa.resolveNode("form1.page2.sub.lines[" + this.parent.index + "].bl.value.line.edge.color").value = "0,0,0";
}

form1.page1.sub2.buttons.N1::ready:layout - (JavaScript, client)

var buttonNum = (this.parent.index+1) + "";
xfa.resolveNode("N1.caption.value.#text").value = buttonNum;