Issue is FormValidator.validateSingleView(this, vehicleNoEditText, simpleCallback)- Not only validate vehicleNoEditText but all the validations declared in the Activities. This also validate pucNoEditText & pucEndDateEditText.( which I don't want to validate with vehicleNoEditText, I have separate validation call for them)
FormValidator.validateSingleView(Object target, View formContainer, View targetView, Map<view, fieldinfo=""> infoMap, IValidationCallback callback) - evaluate Single View then also validate all the other declared validations and returns false.
This is worse as no error shown against the others but I can't submit Form as well.
ValidationKomensky is fantastic Validator but there are 2 issues which put me off.
Issue 1 : FormValidator.validateSingleView() is not working as expected.
For Example,
I have following 3 validations on my form.
@NotEmpty(messageId = R.string.validation_vehicle_registration,order = 1) EditText vehicleNoEditText;
@NotEmpty(messageId = R.string.validation_puc_number) EditText pucNoEditText;
@DateInFuture(datePattern = "dd-MM-yyyy",allowToday = true, messageId = R.string.validation_date_in_future) EditText pucEndDateEditText;
vehicleNoEditText is Mandatory but pucNoEditText & pucEndDateEditText are Non mandatory.
I want to validate pucNoEditText only if pucEndDateEditText is updated.
I implement this validation as below.
if(!FormValidator.validateSingleView(this, vehicleNoEditText, simpleCallback)){ isValid = false; }
if(!StringUtils.isEmpty(pucEndDateEditText.getText().toString())){ if(FormValidator.validateSingleView(this, pucEndDateEditText, simpleCallback)){ isValid =false; } if(FormValidator.validateSingleView(this, pucNoEditText, simpleCallback)){ isValid =false; }
}
Issue is FormValidator.validateSingleView(this, vehicleNoEditText, simpleCallback)- Not only validate vehicleNoEditText but all the validations declared in the Activities. This also validate pucNoEditText & pucEndDateEditText.( which I don't want to validate with vehicleNoEditText, I have separate validation call for them)
FormValidator.validateSingleView(Object target, View formContainer, View targetView, Map<view, fieldinfo=""> infoMap, IValidationCallback callback) - evaluate Single View then also validate all the other declared validations and returns false. This is worse as no error shown against the others but I can't submit Form as well.