How to bind with not in MVC

asked 2013-08-20 06:35:06 +0800

dsised gravatar image dsised
1 1


Do you kjnow how to use not or ! for a value with MVC ?

For exemple in my model I have a value named ImTrue whitch always return true.

So, this is of course always ckecked (it's OK) <label value="checked" /><checkbox checked="@{model.ImTrue}"/>

I'd like to check when the value is false. I tried this : <label value="**NOT** checked" /><checkbox checked="@{**not** model.ImTrue}"/>

or <label value="**NOT** checked" /><checkbox checked="@{**!** model.ImTrue}"/>

or ....

How can I do ?

I know that I can write a getter boolean getImFalse { return not getImTrue()} but I'd like something nicer in my zul.

Any idea ?

Thank you

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-08-20 16:29:25 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

try something like this

 <label value="checked" /><checkbox checked="@load(vm.imTrue eq  true ? 'false' : 'true')"/>

The above code in MVVM Architecture you can change it in MVC as well it should work.

link publish delete flag offensive edit

answered 2013-09-01 23:46:52 +0800

dsised gravatar image dsised
1 1

Thank you for your answer. My problem is xith MVC and not MVVM.

Do you know if this kind of syntax exists for MVC (and not MVVM) ?

Thank you

link publish delete flag offensive edit


Yes it should work on MVC as well you have to Wire the Variable in Java class

sjoshi ( 2013-09-02 13:59:12 +0800 )edit

I'm sorry but @load is only working with MVVM. So I'm looking for the same syntax or a sample in MVC.

dsised ( 2013-09-02 23:08:15 +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

1 follower



Asked: 2013-08-20 06:35:06 +0800

Seen: 21 times

Last updated: Sep 01 '13

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