0

Combobox constraint="no empty" not working correctly

asked 2013-08-12 07:52:12 +0800

adrianlim83 gravatar image adrianlim83
69 1 2

updated 2013-08-12 10:28:19 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

I am currently implementing CRUD standard using zk framework (MVVM pattern), which, the combobox component is one of the best and comply our need. However, certainly, it work as unexpected behavior which I have no idea but would raise this as a bug and hope anyone of you who experience the same can suggest/ approach me with your solution to overcome this issue.

Basically we know that when we define constraint in the component, certain rule must meet before the form can be saved. However, I found certain cases the combobox component doesn't work accordingly.

Use Cases, 1. Click on "Search" button 2. Select an item from listbox 3. Update form will be appear 4. Click on "New" button 5. Update form will be replaced with Creation Form 6. Click on "Save" button, the constraint="no empty" doesn't filter correctly and save function is called.

Sample code:

<combobox **constraint="no empty"** hflex="1" model="@bind(comTypeCodeEnumList)" selectedItem="@load(vm.selected.data.comTypeCode)@save(vm.selected.data.comTypeCode,before='saveData')" rows="1" mold="default" readonly="true" disabled="@load(not(vm.selected.data.objectRef eq '-1'))">
    <template name="model" var="item">
         <comboitem value="@load(item.name())" label="${labelBykey:comboLabelBykey(COMMUNICATION_TYPE_CODE, item.name())}" />
    </template>
</combobox>

Any solutions and feedback is appreciated!

Thanks, Regards, Adrian Lim

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
0

answered 2014-03-30 11:43:11 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-03-30 11:44:39 +0800

PUSH PUSH PUSH

I have the same behavior. (ZK 7.0.1) Customized combobox with MVVM, contstraint='no empty' doesn't work, if i don't touch the combobox and press save button.

Thanks Stephan

link publish delete flag offensive edit
0

answered 2014-03-30 20:31:25 +0800

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

updated 2014-03-30 20:32:50 +0800

Oke here is a work around :

In your command do the following :

@Command
public void command () throws WrongValueException {
    if (selectedItem == null) {
        throw new WrongValueException("there must be something selected");
    }
    // do the rest of your command
}

Documentation of validation and of the WrongValueException.

(You can instantiate the WrongValueException also with a component but then you will have to use binding/context params)

Greetz chill.

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
2 followers

RSS

Stats

Asked: 2013-08-12 07:52:12 +0800

Seen: 71 times

Last updated: Mar 30 '14

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