Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Validation script to clear field
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Validation script to clear field

 Post Reply Post Reply
Author
Scruffy View Drop Down
New Member
New Member


Joined: 21 Aug 2015
Points: 3
Post Options Post Options   Quote Scruffy Quote  Post ReplyReply Direct Link To This Post Topic: Validation script to clear field
    Posted: 21 Aug 2015 at 11:19pm
It worked like a magic!
Thank you!!!
Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 634
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 21 Aug 2015 at 11:15pm
So basically you want to clear 01b when 01a is cleared, right?
If so, use this script as the custom validation script of 01a:

if (event.value=="") this.getField("01b").value = "";
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
Scruffy View Drop Down
New Member
New Member


Joined: 21 Aug 2015
Points: 3
Post Options Post Options   Quote Scruffy Quote  Post ReplyReply Direct Link To This Post Posted: 21 Aug 2015 at 10:16pm
Hi, gkaiseril.

Thank you for your reply but I am not sure what you mean (I am so embarrassed here but I don't know Javascript so it is a space language to me, lol.).

In my original post, I wrote

01c = calculated product of Fields A & B

but I should have said

 01c = calculated product of 01a and 01b

On the form there are many rows (looks like the one below) and each row has a specific product name.  When products are sold, values are entered in the applicable row. 

01a, 01b and 01c are on row 1.  When values are entered on the row 1 (01a and 01b), 01c calculates the amount.

Let's say I enter values on row 1 but later find out I entered the values on the wrong row.  I remove the value in 01a.  Then the calculated amount in 01c disappears but the value in 01b remains there (e.g. $20.00).   I want the value in 01b to disappear as well.

Thank you for your help.
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4111
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 21 Aug 2015 at 9:21pm
The validation script for any field only executes when that specific field is updated either by user entered data or being populated by JavaScript. Since neither of these actions is done to this field, then you validation script does not run. I would look at using the validation or custom JavaScript calculation script for 01a with appropriate modifications for the location.

Edited by gkaiseril - 21 Aug 2015 at 9:22pm
Back to Top
Scruffy View Drop Down
New Member
New Member


Joined: 21 Aug 2015
Points: 3
Post Options Post Options   Quote Scruffy Quote  Post ReplyReply Direct Link To This Post Posted: 21 Aug 2015 at 8:20pm
I don't have knowledge in Javascript but I need to enter a validation script.  I have a PDF form with these three fields:

01a = quantity
01b = price
01c = calculated product of Fields A & B

I want the field 01b to be cleared when the value in the field 01a is removed. Putting the exact script below in the field 01b didn't work:

if(this.getField("01a").value=="")
{event.value=""}

Please help.  Thank you.


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.