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

Fill In

RDAwbrey
Registered: May 20 2008
Posts: 15

I am creating a vacation request form. Is there a way fill in the date square with color without covering the number (Translucent) when a user clicks on the date?

Arobat 8.1.3

My Product Information:
Acrobat Pro 8.1.2, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You'll need to provide more information. When you say date, are you talking about a text form field that a user enters a date string into? Are you using Acrobat or LiveCycle Designer to create the form? Are you asking about setting the background color for a field? Do you need the color to change in response to something, or do you just need to set it once?

George
RDAwbrey
Registered: May 20 2008
Posts: 15
It is a 2009 Calendar (all the Months / Days already there)

JANUARY
S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
In the actual form the days are closer together, under the weekday heading and the dates are inclosed in squares. What I am trying to accomplish in Acrobat is the user clicks on the date(s) for vacation it highlights that square in yellow. It would also be nice if they changed their mind about the date(s) they chose to be able to click on it again and change it back to just the date in the square.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
OK. If you want the individual dates to be interactive, you have to use an interactive element such as a form button. To get it to behave as you want, the button would have to display the date text. A button's background color could be set when it is selected and removed when deselected, but this would involve some simple scripting. If you need help with the scripting, post again.

George
RDAwbrey
Registered: May 20 2008
Posts: 15
Thank you George, I do need help with the scripting.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Here is a basic script that will toggle the background color of a button when used in the button's Mouse Up event:

// If this field's background color is transparent...if (color.equal(event.target.bgColor, color.transparent)) { // Set this field's background color to yellowevent.target.bgColor = color.yellow; } else { // Set this field's background color to transparentevent.target.bgColor = color.transparent; }

For more information in working with colors and JavaScript, see Thom Parker's article here: http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/using_colors/

The next step will be determining which dates the user selected, which could be implemented any number of ways.

George
RDAwbrey
Registered: May 20 2008
Posts: 15
George you are awsome, the script works great. Is there a way to change the opacity so the date (number) shows. Right now the yellow fill in covers the number.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
No, that's the problem. You need to set the button Label (see the Options tab) to the date corresponding to the button.

George
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
I would use the "fillColor" property of the field object.

The note from the "fillColor" descripion:

"In older versions of this specification, this property was named bgColor. The use of bgColor is now discouraged, although it is still valid for backward compatibility"

The 'bgColor" is also used by the media player.

You may also need to set the "defaultValue' of the fields so the date text is not cleared upon reset.

Either field property works, but if the field's value is cleared for some reason, it might appear as the text is covered over. You will also have to make sure the text field's text color is also not the same as the fill or background color.

George Kaiser

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, gkaiseril is right - bad habit.