Constraint "no empty" validation

asked 2016-10-03 04:27:06 +0800

pafi gravatar image pafi


I've got a textbox like this :

<textbox hflex="1" constraint="no empty: Mandatory field" ...../>

I'm ussing MVVC and I've got a "save" button to perform the save on my form on server side.

When I open a new form, my textbox is empty. If I click on save, i've made a validation on server side saying that "the value of the textbox need to be entered".

So far so good...

But when I open a new form, I enterred "text" in the textbox and I press save, my form is persisted with the value "test" in my database and my form is refresh. Now, in the textbox, I delete all the text, I press "save" and I have a different behavior : server side my object hasn't a null value but keeps the "test" value and my textbox is surrended with red.

I hope you understand, i'm french and my english is bad...

I would like that if I clear a textbox, the "null" value is send to the server.

Thank you !

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

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

chillworld gravatar image chillworld flag of Belgium
5322 4 9

I created a fiddle : http://zkfiddle.org/sample/mh714r/1-constraint-test-MVC

It works here but if you can alter it to your situation and mention the version so we can check it out.


link publish delete flag offensive edit

answered 2016-10-03 09:04:37 +0800

Darksu gravatar image Darksu
1991 1 4

Hello pafi,

Don't forget that you can always create your custom constraints via java as shown below:


It comes in handy many times!

Best Regards,


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

1 follower



Asked: 2016-10-03 04:27:06 +0800

Seen: 63 times

Last updated: Oct 03 '16

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