36 Replies Latest reply on Apr 23, 2017 7:52 AM by try67

    Populating textboxes based on content in dropdown boxes

    sw777

      I'm pretty new to JavaScript so I have very little idea how to achieve this. But I'm learning. :-)

       

      I have three (3) dropdown boxes on a PDF form where the user can select a series of courses. All dropdown boxes contain the same list of courses, for example...

       

      Course A - Design widgets

      Course B - Assemble widgets

      Course C - Test widgets

      Course D - Paint widgets

      Course E - Pack widgets

       

      When a selection is made in one of the dropdowns (Course1) an adjacent textbox (NominalHours_Course1) needs to display the number of hours that the course typically runs for (e.g. 5, 8, 12, 15, etc.). This is a predetermined value for each course and needs to be retrieved from a table... (I assume stored somewhere in the document?).

       

      I'm after the same sort of functionality as the MS Excel VLOOKUP function.

       

      Reading some of the posts on this forum, it looks like the relationship between course and hours should be in a document level script, allowing the "Nominal Hours" values to be referenced by any of the dropdown boxes and textboxes. This would also make it easier to change values if required since the changes would only need to be made in the one location.

       

      I have no idea where to start with this. I have tried working through the JavaScript Tutorials on w3schools.com but I think I might be trying to bite off more then I can chew (being such a beginner at JavaScript).

       

      Hoping someone can help.