1

I've looked all afternoon to try and find this one. Basically, I want get the name of the current text field and change the display value to noPrint if the text field value is "--". I'm running this as a validation script in a PDF. Any help is much appreciated!

if(event.value == '--') 
{
    event.target.name.display = event.target.name.display.noPrint;
} else 
{
    event.target.name.display = event.target.name.display.visible;
} 

1 Answers1

2

You have a couple of things a bit off.

event.value doesn't exist (you can check the available event properties)

If you want to get the value of the element that triggered the event you can do:

var elemValue = event.target.value;

If you want to get the name for the same element you can do:

var elemName = event.target.name;

To hide the element from printing, you can see this answer.

Community
  • 1
  • 1
Filipe Silva
  • 21,189
  • 5
  • 53
  • 68
  • Thank you, Filipe. I used the var elemName snippet and that did the trick. However, I had to use event.value. I tried to post the working code but it looked odd in this comment section. But I did really want to thank you for your help. If I could up vote I would. – DataAnalyst762 Jul 24 '13 at 14:51
  • event.value does exits -> https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJS%2Fevent_properties.htm – Frankstar Sep 04 '20 at 19:41