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

Not displaying null value in a text-field

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Answered

Hi,
 
I made a popup menu to fill a text field, but when user don't select a menu item the text field displays a "null" value.
 
How can I avoid "null" to be displayed and have nothing displayed instead?
 
Download my sample doc here: https://acrobat.com/#d=mPq7ycKPzXmmSCvQ6kILgg
 
 
==> I already post this topic yesterday but it was lost in the fourth cyberspace dimension…

My Product Information:
Acrobat Pro 9.3.1, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
(this is a repost, because the thread was lost after my last reponse to your question)

Why not add an if statement that checks if the returned value was null before applying it to the field?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
try67, thanks for replying twice.
:-)


Sure, I tried the IF statement, but since I'm not a JavaScript programer I can't get anything else than Console error messages…

Can you help?

Here is my code:

var reply = app.popUpMenu('01','02','03','04','05','06','07','08','09','10','11','12');
event.target.value = reply;

try67
Expert
Registered: Oct 30 2008
Posts: 2398
var reply = app.popUpMenu('01','02','03','04','05','06','07','08','09','10','11','12');
if (reply!=null) {
event.target.value = reply;
}

(I'm not using the code tag because it's displaying as a single line...)

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Thank you very much, you saved my form!

And this a great lesson for me: no quote around "null"…
Life is sometimes so cruel…

:-)))