Die Funktion befindet sich in der
Unit WBFuncs und heißt WB_SetRadioCheckboxField()
Aufruf für einen Radiobutton:
WB_SetRadioCheckboxField(WB, 'checkbox', 'RadioButtonName', True);
Aufruf für eine Checkbox:
WB_SetRadioCheckboxField(WB, 'radio', 'CheckboxName', True);
In deinem Fall sollte es so gehen:
WB_SetRadioCheckboxField(WB, 'checkbox', 'spende_modus', True);
Delphi-Quellcode:
function WB_FindFieldByValue(WebBrowser: TWebBrowser; FieldType, FieldValue: string; var Field: TPoint): boolean;
var
i, j: Integer;
FormItem: Variant;
begin
Result := False;
if Assigned(WebBrowser.Document) then
begin
if WebBrowser.OleObject.Document.all.tags('FORM').Length <> 0 then
for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
begin
FormItem := WebBrowser.OleObject.Document.forms.Item(I);
for j := 0 to FormItem.Length - 1 do
begin
try
if (FormItem.Item(j).Value = FieldValue) and
(FormItem.Item(j).Type = FieldType) then
begin
Field.x := i;
Field.Y := j;
Result := True;
Exit;
end;
except
// Exit;
end;
end;
end;
end;
end;
function WB_SetRadioCheckboxField(WebBrowser: TWebBrowser; FieldType, FieldValue: string; Checked: boolean): Boolean;
var
Field: TPoint;
begin
Result := WB_FindFieldByValue(WebBrowser, FieldType, FieldValue, Field);
if Result then
try
WebBrowser.OleObject.Document.forms.Item(Field.x).Item(Field.y).Checked := Checked;
Result := True;
except
Result := False;
end;
end;