I am writing a PWA (TMS Web Project) and use the TWebEditAutoComplete component to get a name. The code to fill the controle is:
procedure TformMain.LoadSpeciesList;
var
url: String;
request: TJSXMLHttpRequest;
js: TJSON;
ja: TJSONArray;
jo: TJSONObject;
i, idx: Integer;
speciesname: String;
begin
edtSpeciesname.BeginUpdate;
try
Console.log('Retrieving species...');
edtSpeciesname.Items.Clear;
edtSpeciesname.Items.StrictDelimiter := True;
edtSpeciesname.Items.Delimiter := ';';
WebHttpRequestSpecies.url := c_url + 'getdata.aspx?item=taxa';
request := await(TJSXMLHttpRequest, WebHttpRequestSpecies.Perform);
js := TJSON.Create;
ja := TJSONArray(JS.Parse(request.ResponseText));
for i := 0 to ja.Count - 1 do
begin
jo := TJSONObject(ja.Items[i]);
speciesname := jo.GetJSONValue('Naam');
Console.log(speciesname);
if speciesname <> 'null' then
begin
if i > 0 then
edtSpeciesname.Items.DelimitedText := edtSpeciesname.Items.DelimitedText + ';';
edtSpeciesname.Items.DelimitedText := edtSpeciesname.Items.DelimitedText + speciesname;
end;
end;
finally
edtSpeciesname.EndUpdate;
end;
end;
The names are retrieved from JSON, but when I enter a character in the edit box the following error message appears in the console :
I have the same implementation in a true web application and here the TWebEditAutoComplete works just fine: Caribbean plant species distribution
What's wrong with the PWA?