WebEditKeyPress, strange problem

Sorry, another question.

I have a WebEdit and a WebButton.
If I click the WebButton, I navigate to another url.
If the WebEdit has a text inside, the ButtonClick adds the text.
Ok, this works.

If the user press enter in the WebEdit, I want add the "WebEdit.Text" too.
But the url remains constant and a "?" is appended.

If I debug in my Firefox browser step by step, it works. Without debugging not.

Here is the code:

procedure TframeSophaMain.btnKundenClick(Sender: TObject);
begin
  if edKundensuche.Text <> '' then
    Application.Navigate( 'Kunde.html?search='+edKundensuche.Text, ntPage)
  else
    Application.Navigate( 'Kunde.html', ntPage);
end;

procedure TframeSophaMain.edKundensucheKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then 
    btnKundenClick( Sender);
end;

Any idea?

I tested this with Chrome, FireFox, Edge and I cannot reproduce this. Pressing Enter adds the WebEdit.Text always.
Project1.zip (5.4 KB)

I'm trying a few more tests.
When I press enter, a "?" appended to the url.
Did I manually put a "#" after the "?" then it works.
I suspect problems with the bootstrap template again.

as soon as I delete the HTML code and only have the TWebEdit in the form, everything works.

Here is the HTML code:

              <div class="app-search">
                <form>
                  <div class="mb-2 position-relative w-100">
                    <input id="Sopha_Main_edKundensuche" type="text" class="form-control" placeholder="Suche...">
                    <span class="mdi mdi-magnify search-icon"></span>
                  </div>
                </form>
              </div>

Does anyone know about the HTML and Bootstrap? What is causing the error here?
As I said, everything works when debugging. Just not in real operation.

You embed this into a <FORM> element, the <FORM>traps the return key to post the page.

Argh!!! I could have figured that out myself
That was the mistake
Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.