Expand my Community achievements bar.

Color a field

Avatar

Level 2

Hello,

I am new to LiveCylce and I have a question.

I own a auto repair shop and have a vehicle inspection form that I use for vehicles that come into the shop. Each item on the form has three checkboxes labeled for the condition of the item.

I am trying to make a new inspection form and each item on the inspection form would have one rectangle next to it that I would be able to change color depending on the condition of the item "Red" for severe or safety issue "Yellow" for recommended & "Green" for acceptable.

I would like to have three buttons on the form that when pressed would change the color of the rectangle that I am on for each color labeled  Severe, Recommended & Acceptable. Or one button that could be pressed once for Red twice for yellow and three times for green. I just want to have one instance of this on the form so I don't have buttons all over the place.

I have attached a pdf of the old form so you can see what it consisted of.

Thanks in advance

48 Replies

Avatar

Level 10

Hi John,

Glad you got the form working the way you want it, including the mandatory fields.

You can have new lines/paragraphs in the caption area of the object, but the object must be high enough to accommodate multiple lines.

If you set the top and bottom margins to zero (Layout tab), then the minimum height for the texfield with two lines at 10pt and bold would be 0.3968in. If you reduced the font down to 8pt, then the height would be 0.3350in.

To be honest I don't think you have enough room on the form for these fields to have two lines in the caption.

If you do want to display two lines in the caption, just double click the caption area to edit it and Enter/Return will insert a new line. You can use Unicode in the XML Source: 
 will start a new paragraph. 

Parallels Desktop.png

Because the Size and Type are in the Tire section, I think it should be obvious that these fields refers to the tires. The other option would be to lengthen the caption and have either "Tire Size" or "T/Size" in a single line.

Another year older, another year wiser

Good luck,

Niall

Avatar

Level 2

Hello and happy new year!

The form seems to be working good.

There is one issue though, when the technician is done filling in the form they can print the form thru the File->Print dialogue and then they do not get the warning that all required fields are not filled in. Is there a way to only print from the print button on the form or have some kind of hidden field or caption that says the form is incomplete?

Avatar

Level 10

Hi John,

You can achieve this by changing the script around. In earlier versions of Acrobat/Reader it is a bit messy - basically you hide the page if the validation fails. In Acrobat/Reader version 9.1 or above a method called "cancelAction" allows you to cancel the print if validation fails - this is much cleaner.

So if you users have Acrobat/Reader version 9.1 or above, then the example here may be of use:

http://www.assuredynamics.com/index.php/category/portfolio/print-if-form-passes-validation/

On the other hand, if your users have earlier versions, then here is a new version of your form (I worked off version 17):

https://acrobat.com/#d=qUUCOKRcYeZW23pM-8*jog

Basically:

  • Script in the click event of the Print button, just calls the print function
  • The validation check is now in the prePrint event. If the validation passes, the form just prints without any further action by the user. However if it fails, then page1 is hidden and a warning is displayed. The user can still proceed with the print (click OK), but only a blank page will print.
  • There is new script in the postPrint event that redisplays page1.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 2

Niall,

I tried Stephan Camerons fix on his Forum

http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/

It works but yours is much cleaner oh great one!

I have changed the form  and tweaked it a little so your version would not be the same as my version.

I am going to place a link to my latest file here it has the code mentioned in the link above.

https://acrobat.com/#d=S37drxrO3qIqbv5M0iyQxA

or... you can tell me what to do with what you sent me and I can take care of it on my own!!

I looked in the XML of the form and saw that prePrint starts on line# 823.

P.S. I hope you had a great New Year and want to thank you so much for all the help you've given me and

all the others you help I think it's really great man!!!!  A lot of us would be lost without you.

John

Uptown Imports Mpls, MN

Avatar

Level 10

Hi John,

It would be better if you copied the print button from my version 17 into your latest form. All of the changes are in this print button.

Working in the XML Source tab is necessary sometimes, but generally I would not recommend it at all for most tasks. You can seriously break your form and it can be difficult to repair. Use with caution.

If you don't have the Script Editor window open, you can access it from the Windows menu. Open it, make it higher than one line by dragging the bottom bar and then keep it open.

When you select an object you can place script in any of its events. You can also set language other settings:

Script editor.png

In your version of the form you just need to amend the script in the click, prePrint and postPrint events of the print button.

I am glad to be of help. Happy New Year to you as well.

Niall

Assure Dynamics

Avatar

Level 2

Niall,

Had to change the name of the page it was not "page1" on my form pasteed the new "Print" buton in. Deleted the "prePrint" I had in the <config.> section in the XML. Then I had to add it to "page1" in the script for the page because it was not there. Seems to work now.

I copied and pasted the code for the "Print" button into the "page1" script can you look at it and see if it is okay? The first line is kind of wierd, I don't know if they are supposed to be together

form1.page1.INFO.ResetButton1::click - (JavaScript, client)

form1.page1.INFO.PrintButton1

::click - (JavaScript, client)

Here is a link to the file

https://acrobat.com/#d=kJT4jCPh4thB1AwlsEuc6A

Thanks

John

Uptown Imports MPLS, MN

Avatar

Level 10

Hi John,

Good catch - I'd forgotten that I named the page to "page1". This was necessary to make referencing objects easier.

Here is the form back to you: https://acrobat.com/#d=tQa7XFjw2-lDVycBxHinoQ

It looks like the script from the print button copied itself onto the script in the reset button, when you copied the button into the form. I have corrected this.

Looks good!

Niall

Assure Dynamics