I have a form that is dynamically created from a database, that enables or disables appropriate controls in a repeater.

This is all working fine, but it also needs branching. IE selecting a certain value for a certain field may make another field appear on screen.

I am not doing the database for this so im limited with chnages I can make on that side of things.

Basically im passed a table that looks like this: (Ive stripped out the irelevance)

qid
InitialStateVisible
QuestionIDChangeState
ChangeStateOption
ChangeStateID

1 1 NULL NULL NULL
2 0 1 equal 1
3 1 NULL NULL NULL
4 1 NULL NULL NULL
5 1 NULL NULL NULL

When loading the repeater Each question is wrapped in a panel, and I set display:none; to the questions where initialstatevisible = false.

in this scenariop this is QID 2. to find out how this should be visiblity should be toggled we look too QuestionIDChangeState, ChangeStateOption, ChangeStateID

In this instance QID2 will be shown when qID 1 has a value that equals 1.

Basicaly what Ive tried is adding classes to the appropriate controls.

To the hidden div (QID2) I add a class of target2, the radiobuttonlist a calss of changer2 and to the radiobutton list I add a javascript onclick of branching(2,'=',1);"


the function looks like this

Code:
 function branching(QID, operator, value) {

    var g = $('.changer' + QID).val();
    alert(g);
    
      //$('.target' + QID).show('slow', function() {
       
     // });

  }
basically I need to find the radiobutton list, check its selected value matches the equals then show the div.

Firstly I cannot get the jQuery right to get the selected value and secondly is this a good way of doing things?

Thanks for your time.