javascriptdelphicomboboxintrawebtms

Delphi 7 - TMS Intraweb DB-aware Grid ComboBox


I have an Intraweb application which is using the TTIWDBAdvWebGrid component. Two columns of the grid are comboboxes (editor is set to edCombo) - look at the picture below

enter image description here

What I want is that when one of the comboboxes is changed the other changed it's value to opposite (if first is YES then the other is NO).

I've tried with javascript code at the ClientEvents-combochange

valcb=GetEditValue(IWDBGESTANTObj,c,r);
if (c==5 )
{
if (valcb='OUI ') {SetCellValue(IWDBGESTANTObj,6,r,'NON'); }
else {SetCellValue(IWDBGESTANTObj,6,r,'OUI');}
} 

but this code changed the values from the second combo to nothing....

How can I resolve this?


Solution

  • Resolved by using the following javascript code:

    if (c==5)
     {wId = "G0D" + r + "C" + (c + 1);}
    else
     {wId = "G0D" + r + "C" + (c - 1);} 
    myCombo = document.getElementById( wId);
    if (ctrl.selectedIndex==0) 
    { wInd=1;}
    else
    {wInd=0;}
    myCombo.options[wInd].selected=true;
    

    Intraweb is generating the id for each combo by concatenating the following elements "GOD" + row_number + "C" + column_number

    This code must be set on the ClientEvents-ComboChange property

    enter image description here