How to populate a field_B with selected items from field_A on the web

I have a form with several fields, two of them are listboxes field_A and field_B.  Field_A is populated with a lookup formula in the "Use formula for choices" No problem with that.  Can anyone help me with a javascript code to populate field_B with selected items ifrom field_A so that it stays there after submit ?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

qwaleteeConnect With a Mentor Commented:
I don't see why you can't just use a formula for choices for field B, and use the following formula: field_A

The values selected in field A will save when submitted, so when you open the doc again, field B will evaluate field A for choices, and come up with the same list that was present last time.
Is field B currently computed field.

in the submit button put this code:

var f = window.document.forms[0];    
f.field_B.options[f.field_B.selectedIndex].text =  f.field_A.options[f.field_A.selectedIndex].text;

Qwal is right, but if you are strictly looking out for javascript solution, here is one:

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

ZvonkoSystems architectCommented:
Put this in the onChange event of Field field_A:


Also be aware that field names are case sensitive in JavaScript.

saemundursAuthor Commented:
Thank you all for your time.  athough not the ideal solution to my problem I can use theaccepted answere as a temp solution.
ZvonkoSystems architectCommented:
And why do you give a grading B??? Don't you know that the experts get less points with a grading B?

Hello to qwaletee <|;-)

saemundursAuthor Commented:
I am actually new to this site and I didn't know that points get multiplied by the grading.  So doing some reading on grading.  Maybe you can give me a hint on how to grade.  When to use B and when A or do you always use A because it gives the most points ?

Anyway, thank you for your input.
ZvonkoSystems architectCommented:
Yes please. Give only grade A as an Thank You, and grade B when you are disappointed. (at least that is my View of grading :)
If you want to correct your grading, then post a request in this topic area:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.