auto fill a text box based on a value from a list box

Community Beginner ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Hello all, 

 

I am creating a form and I have a list box that has three values in it (or four if you include the black space).  I would like a text box to auto-populate with a value based on the value of the list box.  I found this from another thread and have tried to adapt it for my purpose but I am not getting any value to load.  What is posted is modified.

 

event.value = (this.getField("List Box 1").valueAsString=="1")?"": apple

 

Any help would be appreciated

 

TOPICS
How to , JavaScript , PDF forms

Views

105

Likes

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

correct answers 1 Correct answer

Community Beginner , Jul 14, 2022 Jul 14, 2022

I might still need help with the defining of the name.  I am trying to use what was posted previously first.

 

Thank you for the help that you have provided.

Likes

Translate

Translate
Community Expert ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Check the Javascript console for errors.

Likes

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

I am not familiar javascript so I would need a little guideance.

Likes

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Press ctrl-j or cmd-j 

Likes

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Likes

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 ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

Thank you for this.  I will read it over and see if I can use it to adapt to what I have.

Likes

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

If "apple" is text then it must be in quotes. If it's the name of a variable then you have to define that variable first, and that's not present in the code you posted.

Likes

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 ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

LATEST

I might still need help with the defining of the name.  I am trying to use what was posted previously first.

 

Thank you for the help that you have provided.

Likes

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

Make content for your business needs with Adobe Express.

Get started easily with free templates: