answered
2018-04-10 15:50:43 +0800
cor3000 5868 ● 2 ● 7
onChanging
is a server side event listener, and your scenario sounds like it's better dealt with at client side to provide a better user experience. So here a few thoughts on improving the maintainability of your js code, avoiding duplication:
Inside a client side listener it is possible to call functions from separate js files which makes the function reusable in a very basic way.
http://zkfiddle.org/sample/144bqmi/2-separate-mask-function
If you don't like functions polluting the global namespace you can add a custom maskInput function directly to the zul.inp.Textbox.prototype
as in this example
http://zkfiddle.org/sample/144bqmi/3-add-mask-function-to-textbox-widget
If you want to go deeper into client side customization e.g. extending an existing widget class with your own implementation I'd refer to the client side reference: https://www.zkoss.org/wiki/ZKClient-sideReference/GeneralControl/WidgetCustomization
For your case I think either my first or second option should provide a manageable mechanism.
Please let me know if this information was sufficient or not.
Robert