I have setup a ResponsiveList control to display an edit and a button. I have been able to use a button click event to show the value of a hidden field. I would like to access the value in the edit box in that same event. What do I have to change to make that happen?
Here is the definition for the DataTemplate.
ItemsGrid.DataTemplate.Add('<table>');
ItemsGrid.DataTemplate.Add(' <col width="100">');
ItemsGrid.DataTemplate.Add(' <col width="350">');
ItemsGrid.DataTemplate.Add(' <col width="50">');
ItemsGrid.DataTemplate.Add(' <tr>');
ItemsGrid.DataTemplate.Add(' <td valign="top"><img src="<#Image>" width="100"></td>');
ItemsGrid.DataTemplate.Add(' <td valign="top"><B><#Full_Title></B><BR><#Publisher><BR>(W) <#Writer></td>');
ItemsGrid.DataTemplate.Add(' <td valign="top"><s><#Price></s><BR><B><#DiscPrice></td></B>');
ItemsGrid.DataTemplate.Add(' <td valign="top"><input type="text" name="qtyedit" value="1" size="3"></Input> <input id="button" type="button" value="Pre-Order" onclick="' + ItemsGrid.HTMLName + 'ControlEventHandler(event, ''ButtonClick'')"></td>');
ItemsGrid.DataTemplate.Add('</tr>');
ItemsGrid.DataTemplate.Add('</table>');
ItemsGrid.DataTemplate.Add('<input type="hidden" id="StockItemID" value="<#StockItemID>">');
Here is the AsyncControlEvent for the control.
procedure TFormShop.ItemsGridAsyncControlEvent(Sender: TObject; EventParams: TStringList; EventType, ControlID: string; ItemIndex: Integer);
var ids, attrs : tstringlist;
begin
if EventType = 'ButtonClick' then
begin
try
ids := tstringlist.Create;
ids.Add('StockItemID');
ids.Add('qtyedit');
attrs := tstringlist.Create;
attrs.Add('value');
ItemsGrid.AsyncGetAttributes(ItemIndex,ids, attrs);
finally
ids.free;
attrs.free;
end;
end;
end;