Highlighted

Changing field appearance programatically?

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

28-10-2008

We have a user form that is filled out and then printed. I would like to change the appearance of the fields from Sunken Box to None prior to printing to make the printed copy look less like a form. I've not been able to locate a property that corresponds to the Appearance option in Designer. It seems like there should be one available in either Javascript or FormCalc, but I've not been able to locate one. Is there such an "animal" and if so, what is it?



Thanx!



Bill Bain

Atlanta

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

28-10-2008

I am assuming it is only fields that you want to change. Try this:



Fieldname.ui.textEdit.border.presence = "hidden";



To put the border back make the presence = "visible"
Highlighted

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

28-10-2008

Thanks! That worked. Now all I have to do is make it loop through all the fields in the form. Not sure exactly how to do that . . . .
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

28-10-2008

I have a sample ...post your email address and I will send a sample.

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

28-10-2008

Thanks for the help!



bill_bain@hotmail.com
Highlighted

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

28-10-2008

I'm not following why the following doesn't work. I found an example in the Scripting reference for setting the access to "protected." It reports that ui.textEdit has no properties, however the statement changing the access property does work:



//Get the field containers from each page.

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

var oFields = xfa.layout.pageContent(nPageCount, "field");

var nNodesLength = oFields.length;



//Set the field Property

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++){

oFields.item(nNodeCount).ui.textEdit.border.presence = "hidden";

oFields.item(nNodeCount).access = "protected";

}

}



This statement also works:



form1.Page1.Cust_No.ui.textEdit.border.presence = "hidden";



I'm officially baffled.



Bill Bain

Atlanta
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

29-10-2008

Just sent you the sample.



Regarding your next post .....I would put an app alert after the

var nNodesLenth = oFields.length

statement to see if oFields is getting populated with objects.



Assuming it is ....then put an app alert after you get a single object inside of the for loop to ensure that you are dealing with an object:



app.alert(oFields.item(nNodeCount).ui.textEdit.border.presence)
Highlighted

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

29-10-2008

I took your advice and added a couple of app.alerts to help figure out what's going on. I'm not following the code in your .xdp example very well, particularly since I'm new to Adobe.



This one came in quite handy:

app.alert(oFields.item(nNodeCount).name)



the message "XFA:form1[0]:Page3[0]:Button1[0]:click



form1.Page1.RM_Data_Fee.ui.textEdit has no properties"



seem to come up on check boxes AND Numeric fields -- the looping works fine until it hits one of those field types. At that point I get the message. It's kludgy, but for a laugh I moved the check boxes all up in the hierachy and then started the nodeCount with the next number (e.g., moved 2 check boxes and then started the nodeCount with 3) and it ran until it hit a numeric field (!).



I also tried hard coding the border change:



CheckBox1.ui.textEdit.border.presence = "hidden"



and sure enough the check boxes don't have properties? OK, but why it is not processing the numneric fields?



Thanks for your help!



Bill
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

29-10-2008

There is a case in there for checkboxes and numeric fields. For the ones that fail but a message box in and make sure that we are checking for the right className
Highlighted

Avatar

Avatar

_Bill_Bain_

Avatar

_Bill_Bain_

_Bill_Bain_

29-10-2008

the className property in all cases is giving me "field" as it loops through, for both checkboxes and numneric fields.



I feel like there's something I'm missing that should be really obvious. It's just no supposed to be this hard . . . .