Page 1 of 1

the moment of updating the field value on the browser form

Posted: Wed Apr 23, 2025 10:53 am
by Isaev
Hi,

We have an extension with two functions:
- One sets a value to a form field
- The other reads values from the form

We set the value like this:

Code: Select all

Chromium.Browser.MainFrame.ExecuteJavaScript(
  Format('cim_extension.formvalue_set("%s", "%s");', [AProdatName, AValue]),
  '', 0
);
In the JSExtensionAfterExecute handler:

Code: Select all

if (name = 'formvalue_set') then
begin
  // Read values
  Chromium.Browser.MainFrame.ExecuteJavaScript('cim_extension.formvalues_get();', '', 0);
end;

if (name = 'formvalues_get') then
begin
  // Output the result — but the field is still empty! (even though it appears correct visually)
  
end;
However, if we trigger the same reading a bit later (e.g., from a popup menu), everything works correctly!

So — after which event is the field actually updated?

Re: the moment of updating the field value on the browser form

Posted: Wed Apr 23, 2025 1:31 pm
by salvadordf
Hi,

I'm not a JS expert but I would try adding an event listener.
You can also try sending a process message from the extension to the main process after setting the new value.