Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Looking for script help

New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

If I have a form that includes a drop-down box with alpha choices A - Z and I want two different form fields to populate a numeric number based on the the alpha choice, what would that script look like? For example, if the letter "A" is chosen from the drop-down, I need the number "0" to populate one form field and the number "1" to populate another form field. It is possible to auto-populate two other form fields at the same time when the selection is made from the drop-down?

 

Thanks in advance if someone knows how to do this!

TOPICS
JavaScript

Views

145

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
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

You can use something like this as the custom validation script of the drop-down:

 

var f1 = this.getField("Field1");

var f2 = this.getField("Field2");

if (event.value=="A") { f1.value = "0"; f2.value = "1";}

else if (event.value=="B") { f1.value = "2"; f2.value = "3";}

 

etc.

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
New Here ,
May 24, 2021 May 24, 2021

Copy link to clipboard

Copied

So I tried this and it doesn't seem to be working... any other suggestions?

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
Adobe Community Professional ,
May 24, 2021 May 24, 2021

Copy link to clipboard

Copied

LATEST

You need to provide more details. What does "doesn't seem to be working" means, exactly?

Does something happen at all when you change the value of the drop-down field? If so, is it incorrect? Are there any error messages in the JS Console? etc.

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