Aashish Handa
Aashish Handa

Reputation: 47

Dropdown selected value effects other Dropdown options

I am wanting to have a set of interdependent fields of type: 1. Select 2. Select 3. Disabled Textbox

  1. Select: should be populated with Student Names (from CMS, that I am using).
  2. Select: should be populated with Month Name (Jan, Feb, ..., Dec).
  3. Disabled Textbox: should be populated with a fees amount relating to the month selected in #2.

The issue is I am using AdminBSB which has a few design parameters that the CMS that I am using does not allow to use. I am using CouchCMS.

Can a custom code be created that does not involve data-* attributes? Just using the id attribute and jQuery/javascript.

I am looking for something like:

<select name='student_name'>
    <option>Student 1</option>
    <option>Student 2</option>
</select>
<select name='month'>
    <option>Jan</option>
    <option>Feb</option>
    <option>...</option>
    <option>Dec</option>
</select>
<input name='fees' type='text' readonly />

jsFiddle: to explain what is to be achieved

Now when Student 1 is selected Month dropdown should activate and when a month is selected its corresponding fees should be displayed in the textbox. Data population is not what I am looking for. I just look forward for a working design to start with.

Upvotes: 0

Views: 69

Answers (0)

Related Questions