Expand my Community achievements bar.

SOLVED

Text fields - change shading upon text entry?

Avatar

Former Community Member

How can I set a blank text field default to gray shading, and then have the shading change to transparent (no color) if the user enters any text?  Is this possible?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Okay, the last push!

Select the textfield(s) and in the Layout palette set ALL of the margins to 0.000in.

To compensate go to the Paragraph palette and set the Left and Right margins to 1mm (or 1.5mm). You can input the values in mm and LC Designer will convert to the set units (probably in).

Then in the Object > Field palette make sure that the Fill is a light grey and the border a black line.

This should work!

Good luck,

Niall

View solution in original post

8 Replies

Avatar

Level 10

Hi,

Yes it is posible. See an example here: http://assure.ly/ewrLMo.

You would use the exit event with something like this:

if (this.rawValue !== null) {

          this.ui.oneOfChild.border.fill.color.value = "255,255,255"; // white

}

else {

          this.ui.oneOfChild.border.fill.color.value = "248,248,248"; // grey tinge

}

Hope that helps,

Niall

Avatar

Former Community Member

Hmm...there are no errors in the above script, but when I open the form in Reader or Acrobat Pro, the text fields default to blue tinge anyway.  I'd like that blue tinge to go away and see gray or white.

I tried the script in the first "Description" field in this document and there seems to be no change:

https://acrobat.com/#d=8Y-rClzM4G6C*BJOYY-tYQ

Avatar

Level 10

Hi,

I can¹t look at it now, but if you have a look at the script in the docReady

event of the root node ³form1², then you will see that in my example I am

turning off the field highlighting.

See an example here: http://assure.ly/jiZ6tn.

Hope that helps,

Niall

Avatar

Former Community Member

Placing the script in the docReady event did fine to turn of the field highlights for the whole document, but the now the shading script above does not work.  Instead of shading the table cell gray, I now get an "inner border" box within the table cell that looks funky.

Thanks for part of the solution, I hope the other part can be provided.

Avatar

Level 10

Hi,

Make sure that the textfield has a solid fill at design time. Eg in the Object > Field palette, Custom Appreance and give the textfield a light grey solid fill. Also make sure that the form is saved as a Dynamic XML Form in the save-as dialog.

The example to look at is on the left hand column on Page 2.

Good luck,

Niall

Avatar

Former Community Member

Ok, that's 95% there.  The last 5% is this:  My text fields are in table cells, and once I enter text in a cell and exit, it does indeed become white...except for a border that sticks around the inside of each cell that for some reason remains gray after my text is entered.

How would I set it so that the whole cell becomes white, and not just most of the cell with a border that stays the initial gray?

Avatar

Correct answer by
Level 10

Hi,

Okay, the last push!

Select the textfield(s) and in the Layout palette set ALL of the margins to 0.000in.

To compensate go to the Paragraph palette and set the Left and Right margins to 1mm (or 1.5mm). You can input the values in mm and LC Designer will convert to the set units (probably in).

Then in the Object > Field palette make sure that the Fill is a light grey and the border a black line.

This should work!

Good luck,

Niall