[OutSystems UI Web] Error on Outsystems UI Web Search control

Forge Component
(39)
Published on 2 Oct (2 weeks ago) by OutSystems R&D
39 votes
Published on 2 Oct (2 weeks ago) by OutSystems R&D

Hi,

I am seeing some strange behavior on the Search control.

If i hit enter after entering data into the input field, the screen goes crazy in my application.

I am noticing the same issue on the Live style guide.


https://outsystemsui.outsystems.com/OutSystemsUILiveStyleGuide/Search.aspx

If you enter data into the search field on the link above and hit enter, the screen goes crazy.

if the search input is empty, the same thing happens 

Hi Hasani,

That happens because you dont have any button or link on the page to make anything when you hit enter.

Regards,

Marcelo

Hi Marcelo,

Thanks for  your reply.

I actually don't want a button or link on the page, I have a list on the page and I am using the data entered on the search input to refresh the list using the onchange method of the search input.

This works well but if someone hits enter, its a problem.

Is there any way to work around this?

Hi Hasani,

Isn't possible to have an hidden button just for the times that the user clicks enter?

Regards,

Marcelo

Hi, 

You may use a different approach, something like adding JavaScript to prevent the Enter key of being captured:

"window.addEventListener('keydown', function (event) {

    // if the keyCode is 13 ( enter key was pressed )
    if (event.keyCode === 13) {

        // prevents default behaviour
        event.preventDefault();

        $('#" + Link.Id + "').click();

        return false;
    }

});"

Thanks a lot, I will try both approaches and see which works best.

Thanks guys