appsmith
appsmith copied to clipboard
[Feature] Execute action on widget focus and blur
Summary
Need a way to execute action when focus shifts to a particular widget. e.g user clicks on input widget or clicks on selection widget.
is there anyway to make the select widget support onclick/onfocus actions? currently it can support onOptionChange action only, but sometimes I need to fetch select options from my database, then I prefer to fetch options only if the select being focused or clicked.
@SatishGandham do you think this could be a performance improvement? We are debating the functionality and we are stuck with onFocus calling the API repeatedly?
@somangshu I don't think it's going to be a significant improvement. I will not do it for performance improvement alone.
For onFocus, user has to configure it to run only when the data hasn't already loaded. Otherwise it may not be a good experience their end users.
Adding to this: We've had a user requesting for onBlur event too.
I would say that onBlur is the opposite of the original request @eco-monk. Anyhow, this is not yet prioritized
I have been pointed to this feature request based on my request on discord...
I have widgets set up to become disabled once populated so that the entries cannot then be tampered with.
The issue I am finding is that, if I want to type an entry into the widget, the widget disables after the first letter, because in its
eyes the text has changed and it has done its job.
I have used other similar software and with them, the onTextChange feature gets executed once leaving the the widget
(Either clicking outside it or tabbing away from it)
I have seen the onSubmit feature which helps offer a bit of flexibility but ideally I would like the ability to run the JS/Query
once the input field is left ie clicked outside the field or tabbed away.
the onTextChange would be perfect if this was the case, most people when they change text, generally, I feel, are looking to
change more than one letter within the text.
Something which helps achieve what I have written above would be a great addition. As mentioned, the ontextchange triggers as soon as one letter is changed which, whilst may be useful to some people I feel that most people, when changing text would be looking to change more than one letter
Hey @PaulMcF1987 thanks, yes onBlur looks like it will help here. Can you explain this line more?
I have widgets set up to become disabled once populated so that the entries cannot then be tampered with.
I did not understand if widgets are disabled by default and enabled after a user does something else or widgets need to be disabled after user has edited them and clicked away?
PRD for the feature (Open for all) https://appsmith.notion.site/Widget-onFocus-and-onBlur-events-36fc98f9d0d04ce0b369247e91e01e5b
@dilippitchika all inputs are enabled by default, I have some which are then disabled after an entry has been input inorder to avoid tampering or information being lost.
As it stands currently, using onTextChange` we need to type the details out on a separate text editor and then copy and paste into the widget. If we decide to type direct into the widget, the widget disables itself after 1 character entry, the way the widget is set up is essentially causing double work
@kamakshibhat-appsmith moving this to Done pipeline, i hope that's okay