views:

44

answers:

1

Hi,

I have requirement in SPDesigner.

There are list of options in a drop down. There is one more drop down in the same form.

Depending on the first drop down some of the options should be removed from the second dropdown. Depending on other options some other options have to displayed.

First drop down:

<select id='firstdropdown' name='dropdown1'>
<option value='a'>A</option>
<option value='b'>B</option>
<option value='c'>C</option>
</select>

Second drop down:

<select id='seconddropdown' name='dropdown2'>
    <option value='1'>1</option>
    <option value='2'>2</option>
    <option value='3'>3</option>
    <option value='4'>4</option>
    <option value='5'>5</option>
    <option value='6'>6</option>
    <option value='7'>7</option>
    <option value='8'>8</option>
    <option value='9'>9</option>
    <option value='10'>10</option>
    <option value='11'>11</option>
    <option value='12'>12</option>
    </select>

If I select option A from first drop down I need option 1,2,5,6 to be populated in second dropdown If I select option B from first drop down I need option 3,4,7,8,9,10,11 to be populated in second dropdown

If I select option c from first drop down I need option 12 to be populated in second dropdown.

How could I do using Jquery. I have tried my method but same data(redundant) is populated if I change the options more than once in my form.

I have to this using Jquery methods as sharepoint custom list.

Any right directions please? Hari

+2  A: 

this can be solved alot easier by using a great jquery library called spservices on codeplex - http://spservices.codeplex.com/

what your describing is called cascading drop down lists. If you can't find how to implement spservices in your situation, then googling cascading drop down lists will get you pointed in the right direction for the thousands of tutorials available on the web.

I'm not posting code samples because again, its more of a conceptual thing. If sounds like you've got some functioning code but need to button up the rest. The tutorials on cascading drop down lists will be better at describing it than I can.

brian brinley