List of selectors that can be used with the $on method

Do we have a list of the selectors that can be used with the JavaScript $on method.

For example , "change" works, but "mouseleave" and "focusout" do not work.

Method selector that works

fd.field('field').$on('change',function);

Method selector that does not work

fd.field('field').$on('mouseleave',function);
fd.field('field').$on('focusout',function);

Thank you.

Dear @vhancock,
It's pretty much 'change' only at the moment with the exception Data Table control, it has many more - Data Table — Plumsail SharePoint Forms Documentation

It's possible to get other selectors to work, but mostly directly through the HTML content of the element, assigning these events to inputs and usch, rather than through the API.

I can provide an example or two if you can tell what you want to achieve with these selectors, they'll work differently for different field types.

Thank you Nakita.

We are looking for a selector that triggers when the user exits the field.

With "change" the event is being called after every keystroke. We do not want the trigger to happen during the user typing into the field.

Our Use Case is that the user is typing into a multi-line text field, and when they exit the field, we evaluate the text and then pass that text into an AI Agent for analysis.

Thank you.

Dear @vhancock,
Here's a basic example for Multiline Plain text:

fd.field('Description').$el.querySelector('textarea').onblur = () => { alert('Exit'); };

Nikita, thank you again,

That did work.

We are now able to execute code once the user leaves the field.

1 Like

Dear @vhancock,
Happy to hear it! If you build something cool (and sounds like you do from your description), feel free to share it with others, like we have cases here - Success stories from Sharepoint Forms users

Of course, only if you're allowed to, want to and have the time, we can do a quick call for example, just drop me an email to n.kurguzov@plumsail.com - I'll help with everything.