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

Java Script If Statement with message

Judy7108
Registered: Jan 21 2009
Posts: 14

I am working on a time sheet. There are text fields that count the check boxes. The total number is then calculated in another Text box. This sum is in "Text16". I need an If statement that checks Text 16 and if the sum does not equal 10 a message will pop and say "Total Days do not equal 10". I have search these boards and tried several different variations.

I can't use validation on Text16 because the message will pop up everytime they check a box and they will have to keep clicking "okay" which would be annoying.

I entered a text box and under custom calculation

I have tried

If (Text16 != 10){document.write("Total Days do not equal 10")

another

//Get total Days
var Text16=this.getField("Text16");
var nval=this.get.Field("Text16").value;
if(nval != 10)this.getfield ("CommentField").value"Total Days do not equal10";

as you might be able to tell I am taking existing code and trying to plug items in to fit my needs.

I have used visual basic with Excel but never tried using the Javascript with Adobe.

Any help would be greatly appreciated.

Thanks!

My Product Information:
Acrobat Pro 8.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You need to use the app.alert()
to display a pop-up.

//Get total Daysvar nval=this.get.Field("Text16").value;if(nval != 10) {app.alert({cMsg: "Total Days do not equal10",  nIcon: 1, nType: 0, cTitle: "Total Days Validation", });

George Kaiser

Judy7108
Registered: Jan 21 2009
Posts: 14
Thanks so much for your reply. I realize I worded my problem wrong. I want to fill in a text box with
the message(in red if possible) with the comment "Total days do not equal 10". The code you gave me does validate which means each time they click on a textbox they will have to click "Okay" on the pop up window . This will happen because the days will not equal 10 until they are done. The box wouldn't interrupt them but would go away when they hit 10 days. I have been working on this off and on for days so I do appreciate any direction you can give me.

Thanks!