Custom constraint programmatically, set message box position

asked 2021-09-08 06:13:07 +0800

alexamm gravatar image alexamm
104 4

Hi, i have a custom constraint programmatically then i set this constraint to a input component, but the message box error cover other component, i need to set other position to message box error from first component. From the zul it's easy, but from java it's possible?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2021-09-08 18:22:39 +0800

MDuchemin gravatar image MDuchemin
2213 1 5
ZK Team

updated 2021-09-08 18:57:06 +0800

Hi There!

You can use the same syntax in Java as you would in zul. https://zkfiddle.org/sample/1cr3cre/3-Constraint-position-in-java

setConstraint has overloads with different signatures. If you want to use the "same as zul", you can use the one that accepts a string as argument.

Is that what you were looking for?

EDIT: For a fun but more complicated use case, extending simpleConstraint lets you do java-side validation while still being able to pass constraint flags (such as position) to the client. https://zkfiddle.org/sample/1cr3cre/8-Constraint-position-in-java https://zkfiddle.org/sample/1cr3cre/8-Constraint-position-in-java

link publish delete flag offensive edit

answered 2021-09-08 22:20:38 +0800

alexamm gravatar image alexamm
104 4

@MDuchemin thanks a lot, it works! I used Constraint intead of SimpleConstraint, with SimpleConstraint it was what I was looking for

link publish delete flag offensive edit
Your reply
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

1 follower



Asked: 2021-09-08 06:13:07 +0800

Seen: 6 times

Last updated: Sep 08 '21

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