ZK ComboBox constraint firing on getSelectIndex()

asked 2013-05-03 12:16:20 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
90 1 5

updated 2013-05-03 12:16:41 +0800

hi i have a comboBox like this

<combobox id="ttr" constraint="${cmv}" onChange="ttrSelected()">

the first time the comboBox have nothing selected but sometimes i need to know the value coming from a overlapped window to check a button[disabiling or enabliing]

as you can see the comboBox have a constraint looks like this.

public void validate(Component comp,Object value)throws WrongValueException
    if (value.toString().isEmpty()){throw new WrongValueException(comp,"The field is mandatory");}

this is working OK but when i need to know the current selected item on the validation.

Student student = (Student)ttr.getModel().getElementAt(ttr.getSelectedIndex());

results in firing the constraint and of course the value is emtpy and 2 things occur.

1). the current execution of my validation stops because a WrongValueException is throw.

2). the validation occurs on the form.

my question is why the constraint is firing on getSelectedIndex()?? i think it should fire on setSelectedItem() or something..

why validated on an inmutable method?

i am using ZK 5.0.8 in MVC style

delete flag offensive retag edit
Be the first one to answer this question!
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-05-03 12:16:20 +0800

Seen: 12 times

Last updated: May 03 '13

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