I have a question regarding form validator
I use form field factory to attach my field(s)
public class RoleAddFieldFactory extends DefaultFieldFactory {
private static final long serialVersionUID = -6699579892309818723L;
private static final String COMMON_FIELD_WIDTH = "12em";
public RoleAddFieldFactory() {
}
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Field f;
f = super.createField(item, propertyId, uiContext);
if (RoleAddFormComplexLayout.ROLECODE_PROPERTY_NAME.equals(propertyId)) {
TextField tf = (TextField) f;
tf.setCaption("Kod Peranan");
tf.setRequired(true);
tf.setRequiredError("Sila masukkan kod peranan");
tf.setWidth(COMMON_FIELD_WIDTH);
tf.setMaxLength(EntityConstant.Role.ROLE_CODE_LENGTH);
tf.addValidator(new KodPerananValidator("Data already exist"));
tf.setWriteThrough(true);
} else if (RoleAddFormComplexLayout.ROLENAME_PROPERTY_NAME.equals(propertyId)) {
TextField tf = (TextField) f;
tf.setCaption("Nama Peranan");
tf.setRequired(true);
tf.setRequiredError("Sila masukkan nama peranan");
tf.setWidth(COMMON_FIELD_WIDTH);
tf.setMaxLength(EntityConstant.Role.ROLE_DESCRIPTION_LENGTH);
}
return f;
}
}
Once i submit the form and all the validation is success, once the form loaded back it will display an exclamination mark for ROLECODE_PROPERTY_NAME field.
Is there anyway once i submit the form, i would be able to detach any validator link to that field.