I have some logic that is called during validation and part of this logic
is to determine the type of form submission based on a selected radio
choice button. For instance, the user can choose "Still Updating" or
"Final". When "Final" is selected the data moves on to the next step in a
workflow and the record is no longer editable by the user.
In the validation logic I call a helper method which looks like this:
public boolean isFinalSubmission() {
RadioGroup<Integer> status = (RadioGroup<Integer>)
form.get("submissionStatusChoice");
Integer statusConverted = submissionStatusChoice; // backing model
object of the radio choice (a property on the panel)
if(status.getConvertedInput() != null) {
statusConverted = status.getConvertedInput();
}
if (LOG.isDebugEnabled()) {
LOG.debug("status.getConvertedInput(): " + status.getConvertedInput());
LOG.debug("status.getModelObject(): " + status.getModelObject());
}
if ((statusConverted.equals(SubmissionStatus.FINAL.getIdentifier()) ||
statusConverted.equals(SubmissionStatus.INITIAL_FINAL_EER.getIdentifier()))
&& submitToAQB) {
return true;
} else {
return false;
}
}
My debug messages are printing different values for the submission status.
14:42:50.050 [http-8080-1] DEBUG u.n.s.n.e.w.p.report.ReportEntryForm -
status.getConvertedInput(): 4
14:42:50.050 [http-8080-1] DEBUG u.n.s.n.e.w.p.report.ReportEntryForm -
status.getModelObject(): 3
Couple questions, is the backing model on a form component updated after
form validation passes completely and successfully? Second, is
myFormComponent.getConvertedInput() a bad practice?
Thanks