Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Real time update on a field as the user types, instead of waiting for on onChange event

prajapatias
Tera Contributor

I need to create a field on a catalog item where, as a user types, a space is automatically added after every four characters without waiting for the user to leave the field or move the cursor.

A standard onChange Client Script only trigger when the user leaves the field, which is not work as i want.

So i create a UI Macro

prajapatias_0-1738948701890.png

as above code a event listener called every time when user input any character to field and add space after every four character.

add this macro to field attribute as "ui_macro = <UI Macro Name>".

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@prajapatias 

I won't recommend using this.

What's your question here?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

While the user is typing, automatically add a space after every four characters before they leave the field or move the cursor away.