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

Script help needed for visible/invisible field

Formfingers
Registered: Feb 7 2007
Posts: 90
Answered

Okay, I give up...searched forums, googled it, and can't find the "I'm assuming easy answer" for this script I need help with:
 
I have a "DaysNeeded" text field and a "TotalAmount" numeric field on my subform. No matter what a user inputs, the minute they type into the "DaysNeeded" field, the "TotalAmount" field should pop up and display $75.00. This dollar amount needs to appear ONLY when a user enters the "DaysNeeded" field. Otherwise, it's GOT TO stay blank; because for the users not filling this in electronically (print out), I can't have that $75.00 displaying, especially if they don't need it. Make sense?
 
I'm assuming this is a visible/invisible script, but can't figure out how to make it work. Found everything under the sun in relation to check boxes or radio buttons...but this is different. What does it need to be (validate/mouseEnter/enter, etc.??? Formcalc/java?? I'm lost...)
 
Thanks to all for your input!

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
Why does it need to be visible/invisible? Why not just leave it blank if unneeded?

Is anything else affecting the TotalAmount field? Is is used by any other field?

Use the check event on the "DaysNeeded" field. This event is run anytime the user types something into the field

Change Script(JavaScript)

if(xfa.event.newText.length)
TotalAmount.rawValue == "$75.00";
else
TotalAmount.rawValue == "";

I'm assuming that TotalAmount is read only, and a text field with no formatting.


Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script