0

intbox trim before paste

asked 2019-12-09 12:54:36 +0800

Fujitsu gravatar image Fujitsu
117 2

updated 2019-12-09 14:23:43 +0800

Good day, a problem that is happening to users is that they copy and paste numeric values very frequently on an Intbox, however in some cases some additional spaces are also copied inadvertently for the user and when they try to paste in the Intbox field they can't because these are interpreted as alphanumeric. If they paste from clipboard in a Textbox then the numbers are pasted with the additional leading or trailing spaces. Is it a way to capture the Paste event in the Intbox and trim() clipboard selection before value is passed to the Intbox? I have already tried extending Intbox and overriding setValue, setText and similar methods to no avail. I am using ZKEE 8.6.1.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-12-09 15:14:55 +0800

MDuchemin gravatar image MDuchemin
2228 1 5
ZK Team

Hi There,

You won't get to the value in Java code, because it is being filtered by the client-side JS and prevented from even going through if incorrect. I think the best place to override this would be in zul.inp.Intbox.prototype._shallIgnore which controls whether to keep or throw the copy/paste action. (it checks the pasted data for non-number characters, then accepts or rejects it).

Made a short fiddle to illustrate:

http://zkfiddle.org/sample/3faufjm/2-intbox-check-trim-spaces

link publish delete flag offensive edit

Comments

Hi There, It makes sense, I will have a try. Thanks a lot for the reply.

Fujitsu ( 2019-12-10 07:16:37 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-12-09 12:54:36 +0800

Seen: 7 times

Last updated: Dec 09 '19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More