-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
is there a solution to disable / enable the wrongvalueexceptions for a zul page? Because i dont want the validation when i blur a input component. i only want to validate when i click the save button from my zul page.
greets
You can set all your constraints in a java method.
. . . private boolean validationOn; . . . /** * Saves the components to table. <br> * * @throws InterruptedException */ public void doSave() throws InterruptedException { . . . // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // force validation, if on, than execute by component.getValue() // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if (!isValidationOn()) { doSetValidation(); } try { getguestBookService().saveOrUpdate(aGuestBook); } catch (DataAccessException e) { ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString()); } . . .
/** * Sets the Validation by setting the accordingly constraints to the fields. */ private void doSetValidation() { textbox_gubUsrName.setConstraint("NO EMPTY"); textbox_gubSubject.setConstraint("NO EMPTY"); }
.
/** * Disables the Validation by setting empty constraints. */ private void doRemoveValidation() { textbox_gubUsrName.setConstraint(""); textbox_gubSubject.setConstraint(""); }
getters/setters
public void setValidationOn(boolean validationOn) { this.validationOn = validationOn; } public boolean isValidationOn() { return this.validationOn; }
best
Stephan
Asked: 2011-03-07 08:48:36 +0800
Seen: 676 times
Last updated: Mar 30 '11