0

How to link the ZK form with submit button

asked 2014-05-29 14:50:29 +0800

AricheKhalid gravatar image AricheKhalid
3 1

I'm new in zk ,I have a form with field and I defined some constraint on those fields and a submit button ,who can I link the submit button with the form and fields ,so I want click on the button the fields where the constraint not satisfied will appear in red ,Now my button doesn't see if the constraint are satisfied ,I know that I could verify in java code but that will not make the fields.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-05-29 19:26:41 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

updated 2014-05-29 20:39:45 +0800

Here is a nice example on zk fiddle of how you do it in MVVM.

You need to work with @load and @save seperated so you can tell to save before the command. When your constraint fails the @command is never fired.

<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('pkg$.VM')">
    <hbox>
        <textbox value="@load(vm.name) @save(vm.name,before='register')" constraint="no empty" />
        <label value="@load(vm.name)" />
    </hbox>
    <hbox>
        <button label="register" onClick="@command('register')" />
    </hbox>
</window>
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

Follow
1 follower

RSS

Stats

Asked: 2014-05-29 14:50:29 +0800

Seen: 29 times

Last updated: May 29 '14

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