RBA RBA - 7 months ago 100
Javascript Question

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

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?


Resolved by using the following javascript code:

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

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