Expand my Community achievements bar.

SOLVED

Why this code is not working, its simple!

Avatar

Level 8

Hello

I know the field name in myVISITORinfoForm, say, the name is myTextField25, but i do not know its complete path!! but, i want make it grey and readOnly, so i put the below code (i put the cursor on the node of 'myVISITORinfoForm' and selected the DocReady event)

var c = xfa.resolveNode("myTextField5").fillColor = "192,192,192";
var d = xfa.resolveNode("myTextField26").fillColor = "192,192,192";
var e = xfa.resolveNode("myTextField25").access = "readOnly";
var f = xfa.resolveNode("myTextField26").access = "readOnly";

I also tried for another field of myTextField26, i also kept the same code in the events of FormReady, Initialization....but, did not worked!!

myTextField25 and myTextField26 are positioned on the 3rd page in the SubForm of mySubForm12.

Pls. let me know wht am missing?

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you want to make each field read only and grey, then why not script directly in each of the two textfields?

This is the docReady event of both fields:

this.fillColor = "192,192,192";

this.access = "readOnly";

You may want to only do this if the fields are not null (eg when the form is returned to you). In that case you would wrap the script in an if statement:

if (this.rawValue === null)

{

     this.fillColor = "192,192,192";

     this.access = "readOnly";

}

I don't think that the way you are declaring variables and setting properties in one line will work. Also the use of the xfa.resolveNode is not efficient.

Hope that helps,

Niall

View solution in original post

6 Replies

Avatar

Correct answer by
Level 10

Hi,

If you want to make each field read only and grey, then why not script directly in each of the two textfields?

This is the docReady event of both fields:

this.fillColor = "192,192,192";

this.access = "readOnly";

You may want to only do this if the fields are not null (eg when the form is returned to you). In that case you would wrap the script in an if statement:

if (this.rawValue === null)

{

     this.fillColor = "192,192,192";

     this.access = "readOnly";

}

I don't think that the way you are declaring variables and setting properties in one line will work. Also the use of the xfa.resolveNode is not efficient.

Hope that helps,

Niall

Avatar

Level 8

Thank you, there are 2 reasons that why am doing like that:

1) I have 75 fields to set their property as readOnly and grey

2) to avoid code REDENNECY

If add one more PERIOD to my code (pls. see i hv added 2nd PERIOD after VISITOR node), it worked....as below

var a = xfa.resolveNode("VISITOR..myTextField25").fillColor = "192,192,192";
var b = xfa.resolveNode("VISITOR..myTextField25").access = "readOnly"

Pls. suggest me, would you like me to go with your suggestion that wrting script EACH filed's docReady event? if so, there are 75 fields!

Thank you  

Avatar

Level 10

I am gone now until tomorrow. There is a section in Adobe guidance on searching, but I can't get to it until tomorrow. Niall

Avatar

Level 8

Thank you.

But, anuhow, you know.... based on your informative statement "xfa.resolveNode" is not efficient.....am wrting script at EACH field level.

But, you know, this issue is bothering me (i want to color ONLY to input box area, not also caption), pls. help me, thrtead is as below

http://forums.adobe.com/thread/886161?tstart=0

i tried the below syntax, but not working!

(this.ui.textEdit.border.fill.color.value = "224,224,224") from

http://forums.sdn.sap.com/thread.jspa?threadID=1596235

Avatar

Level 10

Hi,

In relation to colouring the value area of a field, have a look at page two of this example: http://assure.ly/ewrLMo.

this.ui.oneOfChild.border.fill.color.value = "224,224,224"; 

In relation to the use of the double period syntax for searching, have a look at pages 63 to 65 of this guide: http://help.adobe.com/en_US/livecycle/9.0/LiveCycle_Designer_Scripting_Basics.pdf.

If you are using JavaScript then you have to use the xfa.resolveNode. However I would not assign them to a variable:

xfa.resolveNode("VISITOR..myTextField25").fillColor = "192,192,192";
xfa.resolveNode("VISITOR..myTextField25").access = "readOnly";

I hope that helps,

Niall

Avatar

Level 8

Thank you, am checking it & implementing, keep you posted