I have a webpart that has a search bar. In the Internet Explorer it works fine.


But when the user writes a text in the search bar of the webpart in Google Chrome, the site refreshes and the web part opens in Edit Mode:


I looked at the code and this is what happens, when the user write something in the search bar:

outHtml += '<td >&nbsp;Suche</td><td width="170px"><input onkeyup="startSearch()" id="Suche" type="text" ></td>';

This is the startSearch method:

function startSearch() {
    delay(function () {
    }, 1500); 

and this is the loadList function:

function loadList() {

    var query = getQuery();
    var select = "$select=Id,ITKennung,Nachname,Vorname,Personalnummer,Kostenstelle,Abteilung,Standort,Telefonnummer,Status,Vorgesetzter/Title";
    var expand = "&$expand=Vorgesetzter";
    var order = "&$orderby=Nachname asc&$top=10000";
    query = "?" + select + expand + query + order;

    //if (query != "") {
    loadGrid("Mitarbeiter", query + "", "gridMitarbeiter", cnEmployees, cmEmployees);

How can one fix this fatal bug?

1 Answer 1


I had the exact same issue some time ago.

Some users were actually getting a permissions issue, since the page tries to go into edit mode and they don't have access to edit pages.

This was the solution I found.

    function WebForm_OnSubmit() {
        return false;

If you just want to prevent a special event from triggering the edit mode, you can also try,

<input onkeyup="startSearch(); return false;" id="Suche" type="text" >

Edit mode with the Enter Key

  • Thanks. Where do I have to write that in the code? Commented Mar 10, 2020 at 10:39
  • you basically need to stop the page from posting back when you press enter. you either do it globally using the top script, or tweak your onkeyup so that it returns false. answer updated. these scripts can go alongside your existing code Commented Mar 10, 2020 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.