0

How can I use my custom constraint along with ZK's default constraint?

asked 2012-06-21 21:59:42 +0800

pjiang gravatar image pjiang
46 2

I have a custom constraint which I need to use sometimes with ZK's default constraint.

here is my sample code:

<zscript>
EmailConstraint ec = new EmailConstraint();
</zscript>

<textbox id="email" value="@{user.email}" constraint="no empty, ${ec}" />

I got an exception when page is rendered...Message is "unknown constraint"

Can I use custom constraint and default constraint together?

thx

Paula

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-06-21 22:14:45 +0800

pjiang gravatar image pjiang
46 2

BTW, it works fine if I ONLY use either my custom constraint or the default constraint.

link publish delete flag offensive edit

answered 2012-06-22 03:41:10 +0800

Jales gravatar image Jales
161 1

Does your custom constraint extends the SimpleConstraint?

You might want to simplify it, just extends the SimpleConstraint, create new flags, so that
you can instantiate your custom constraint with the new flags,
and then try to apply the constraint from the composer, not from the .zul file. :)

link publish delete flag offensive edit

answered 2012-06-22 15:58:01 +0800

pjiang gravatar image pjiang
46 2

No, my custom constraint just implement Constraint.

I created my custom constraint base on the instruction on this page:
http://books.zkoss.org/wiki/ZK_Component_Reference/Base_Components/InputElement#Custom_Constraint

link publish delete flag offensive edit

answered 2012-06-28 02:23:39 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Hi pjiang,

You cannot use the default one with the custom one.

link publish delete flag offensive edit

answered 2013-11-13 11:16:10 +0800

smuellner gravatar image smuellner
1

updated 2013-11-13 13:32:51 +0800

So you can even not mix default and custom constraints programmatically?

For example is this fiddle only possible, if you remove the modulo constraint?

zkfiddle.org/sample/3hpmnka/13-Multiple-custom-constraints-mixed-with-default-constraints

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

Follow

RSS

Stats

Asked: 2012-06-21 21:59:42 +0800

Seen: 206 times

Last updated: Nov 13 '13

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