Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS IntraWeb Component Pack Pro
TTIWResponsiveList: How to add an item with an input field and a button that retrieves the value of the input field
TTIWResponsiveList: How to add an item with an input field and a button that retrieves the value of the input field
You can use HTML tags to add form controls to an item. Assign the onclick handler of an HTML button to trigger the OnAsyncControlEvent. Use the OnAsyncControlEvent to execute the AsyncGetAttributes call. For a text field you can use the “value” attribute. The OnAsyncGetAttributes event then returns the requested attribute value(s).
Sample code:
procedure TformResponsiveList1.IWAppFormCreate(Sender: TObject); var li: TIWListItem; begin li := TIWResponsiveList1.Items.Add; li.Text.Add(''
<input type="text" id="textid" value="test">''); li.Text.Add(''
<input type="button" id="button" value="Button" onclick="'' + TIWResponsiveList1.HTMLName + ''ControlEventHandler(event, ''''ButtonClick'''')">''); end; procedure TformResponsiveList1.TIWResponsiveList1AsyncControlEvent( Sender: TObject; EventParams: TStringList; EventType, ControlID: string; ItemIndex: Integer); var id, att: TStringList; begin if EventType = ''ButtonClick'' then begin id := TStringList.Create; id.Add(''textid''); att := TStringList.Create; att.Add(''value''); TIWResponsiveList1.AsyncGetAttributes(ItemIndex, id, att); id.Free; att.Free; end; end; procedure TformResponsiveList1.TIWResponsiveList1AsyncGetAttributes( Sender: TObject; EventParams: TStringList; ItemIndex: Integer; ControlIDs, AttributeNames, AttributeValues: TStringList); begin WebApplication.ShowMessage(AttributeValues.Text); end;