Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Dropdown make change to other objects (javascript?)

  Asked By: Audrey    Date: Dec 26    Category: Sharepoint    Views: 1802

What I am trying to do is create a dropdown that will change the status of a
radio button to
match a value in the dropdown.
For example:
The dropdown values would be 1,2,3,4,5
The radio buttons are: A,B,C,D,E

If say "2" was selected I'd want it to select radio button "B". "4" I want "D".
In practice what this will be used for is automatically check the correct region
radio button to
go with a county in the dropdown.

It seems that this could be done with javascript.



1 Answer Found

Answer #1    Answered By: Lesley Tate     Answered On: Dec 26

How are these dropdowns and radio  buttons being created? Do you have access
to their ID and/or name attribute(s)?

Essentially, you'll need to add an event handler to the dropdown  list that
catches the onchange event and passes a reference to the DDL, e.g.


Then in a Javascript function -- provided you have the name of the radio
button list or the ID of one of them -- you could do something like this:

function changeRadioButton(oList) {
var sRbID = sRadioID;
var sRbName = document.getElementById(sRbID).name;
var oForm = document.forms[0];
// if you have more than one form, you can probably get the reference
through a control
var aRadioList = oForm.elements[sRbName];

aRadioList[oList.selectedIndex].checked = true;


Let me know if this helps or if I missed your point entirely.

Didn't find what you were looking for? Find more on Dropdown make change to other objects (javascript?) Or get search suggestion and latest updates.