• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

blank selection for dropdown

Participant ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

I have a drop down that is required. but I do not want to have a selection pre chosen. I want to see it empty when first opening the form.

but when I do that, it accepts the blank as a choice.

I want to set the field as required but and force user to make a choice.

TOPICS
PDF forms

Views

11.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Use this:

if (this.getField("typeofestablishment").valueAsString=="click for more options") {

    app.alert("Please select a valid Choice Number 5");

} else if (this.getField("typeoflossortheft").valueAsString=="click for more options")  {

    app.alert("Please select a valid Choice Number 6");

} else this.mailDoc({cTo: "me@server.com"});

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

If you use the UI then you enter a space. You can only add an empty or null string usong JavaSript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

UI, you meant the form field properties....I tried that and it accepts it. I do not want it to accept a blank.

How to do this, which is not clear

Uou can pnlu add an empty or null string usong JavaSript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

You can add an empty string as the default value using a script, like this:

this.getField("Dropdown1").setItems(["", "Item 1", "Item 2", "Item 3"]);

I'm not sure if it will cause the required fields validation to fail, though, if that empty item is selected.

If it doesn't then you will also need to perform that validation using a script. I've posted similar scripts here in the past. Try searching for "validate required fields".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Being new at JS still, I may have mis spoke. I am trying to learn ad do stuff on my own, but holy JS is not easy.

I need a script that will check 2 dropdowns to make sure a choice was made. There is a default of 'click for more options'.

So my script checks to see if click for more options was chosen, if so it generates an error message......but then still emails the form.

I need to get the email submit in the script, not sure how.

This is what I have. I tried using and AND/OR but it did not work.

if (this.getField("typeofestablishment").valueAsString=="click for more options") { 

         app.alert("Please select a valid Choice Number 5"); 

     }

else if (this.getField("typeoflossortheft").valueAsString=="click for more options")  {

app.alert("Please select a valid Choice Number 6");

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Use this:

if (this.getField("typeofestablishment").valueAsString=="click for more options") {

    app.alert("Please select a valid Choice Number 5");

} else if (this.getField("typeoflossortheft").valueAsString=="click for more options")  {

    app.alert("Please select a valid Choice Number 6");

} else this.mailDoc({cTo: "me@server.com"});

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 30, 2020 May 30, 2020

Copy link to clipboard

Copied

May I ask where to put the JavaScript?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2020 May 30, 2020

Copy link to clipboard

Copied

As the Mouse Up event of your submit button.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

I know this is old, but I haven't seen anyone put the correct and easy way to do this anywhere. Putting it here in case anyone else runs into this issue.

 

After adding dropdown items in Item List, if you want the default to stay blank, simply click the white space under the different items in Item List. Done.

 

Hope this helps whoever runs into the same issue.

 

-69butthead69

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

And what when that list is filled with more then 7 items  and white space is gone, it will only work if you have like 1-6 items.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

Command-click the selected dropdown item. It will become unselected, and the field will become blank.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

That's in "edit fields"/"properties"/"options", by the way.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

What would be that on windows, because i clicked while pressing  using CTRL, SHIFT and ALT none of them worked?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

The solution mentioned above is not the right way to do it, and will not work consistently in all platforms. It's a bug, if anything, not a feature.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

It's a "bug" that works consistently for me, on two different Macs and with two different versions of Acrobat. I guess that makes it a (Mac-only) feature. Meanwhile, I find that with Acrobat XI on my office PC no matter how many items are in a dropdown list there's still white space at the bottom of the list that can be clicked on to de-select an item. Is this something that Adobe, in its wisdom, disabled in recent versions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 27, 2024 May 27, 2024

Copy link to clipboard

Copied

2 years later in Adobe Acrobat 2020 this "bug" still works consistantly on window 10 - scroll to the bottom of the list in options pane and click the white space at the bottom and boom it clears and sets the default to null

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2022 May 25, 2022

Copy link to clipboard

Copied

Thanks for this. Saved me a lot of time! 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 29, 2023 Apr 29, 2023

Copy link to clipboard

Copied

Thank you so much for giving me an easy answer!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 27, 2024 May 27, 2024

Copy link to clipboard

Copied

thank you so much for going back and adding your comment 2 years after - 2 years after that it's still saving people like me! scroll the botton of the list in options tab, click the white space below the list, boom. done. THANK YOU!! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2024 Dec 03, 2024

Copy link to clipboard

Copied

LATEST

I hope you are relaxing on the a beach somewhere! You deserve it. Thank you so much! I have spent 2 days, 100s of searches, at least 10 videoes on Adobe and JavaScript, trying to figure out how to do this so that the form can be printed and filled out manually, if desired. So simple!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines