Hello:
I am trying to do a custom validation in one field of the listGrid. I write the following simple code. But it doesn't work. The custom validator is never executed.
Could you help me? What am I doing wrong?
Thanks in advance.
I am trying to do a custom validation in one field of the listGrid. I write the following simple code. But it doesn't work. The custom validator is never executed.
Code:
ListGridField itemIdField = new ListGridField("itemId", RECTIFICATIONS_MESSAGES.fieldItemId()); itemIdField.setRequired(true); itemIdField.setCanEdit(true); itemIdField.setType(ListGridFieldType.INTEGER); IntegerRangeValidator itemIdRange = new IntegerRangeValidator(); itemIdRange.setMin(0); itemIdRange.setMax(999999); CustomValidator c_validator = new CustomValidator() { @Override protected boolean condition(Object value) { GWT.log("Custom validation false"); return false; } }; String[] dep_fields = {"itemId"}; c_validator.setDependentFields(dep_fields); c_validator.setErrorMessage("Error de validacion customizado."); c_validator.setValidateOnChange(Boolean.TRUE); itemIdField.setValidators(itemIdRange,c_validator); itemIdField.setValidateOnChange(Boolean.TRUE);
Thanks in advance.