Question

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

normal

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:

editmode

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 () {
        loadList();
    }, 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 != "") {
    $.jgrid.gridUnload('gridMitarbeiter');
    loadGrid("Mitarbeiter", query + "", "gridMitarbeiter", cnEmployees, cmEmployees);
    //}
}

How can one fix this fatal bug?

Was it helpful?

Solution

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.

<script>
    function WebForm_OnSubmit() {
        return false;
    }
</script>

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top