198
Views
5
Comments
Solved
Enable button after entering at least 3 characters
Question

I have a search FIELD and search BUTTON.

I'd like to have the BUTTON disabled - UNTIL - the user enters at least 3 characters.

I am using the OnChange event to call a ScreenAction that checks the input length and enables/refresh the button. It works great - BUT - the lag of the OnChange is a problem as folks often type the search query and hit the enter key BEFORE the OnChange even fires.

Ideally, is there a way to have the ScreenAction module fire OnKeyPress instead of OnChange?


2020-02-28 09-46-54
Eduardo Jauch
Solution

Hello Bruce,

You can use the Extended Properties section of a widget to add attributes to the element, like the OnKeyPress, OnKeyUp, OnClick, etc.

The value can be JavaScript.

Ex:

OnKeyUp

= "MyJSFunction();"

To call a ScreenAction, you can use the FakeNotifyWidget From Richwidgets.

But I would say that you can simply check in JavaScript if the input has 3 or more characters and enable/disable the button directly from the JavaScript.

Cheers

2018-06-24 00-44-25
Bruce Buttles

Correction, I edited my question ... I want to be able to call a ScreenAction (not a Logic module) "OnKeyPress" rather than OnChange that is built-in.

2020-02-28 09-46-54
Eduardo Jauch
Solution

Hello Bruce,

You can use the Extended Properties section of a widget to add attributes to the element, like the OnKeyPress, OnKeyUp, OnClick, etc.

The value can be JavaScript.

Ex:

OnKeyUp

= "MyJSFunction();"

To call a ScreenAction, you can use the FakeNotifyWidget From Richwidgets.

But I would say that you can simply check in JavaScript if the input has 3 or more characters and enable/disable the button directly from the JavaScript.

Cheers

2020-02-28 09-46-54
Eduardo Jauch

Hello Bruce,

How are you?
Did you solve the issue? Do you need more info or help?

Cheers

2018-06-24 00-44-25
Bruce Buttles

Eduardo Jauch wrote:

Hello Bruce,

How are you?
Did you solve the issue? Do you need more info or help?

Cheers

Thanks for following up - yes, the FakeNotifyWidget did the trick thanks!


2020-02-28 09-46-54
Eduardo Jauch

Nice :)

Cheers.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.