is the backing model on a form component updated after
form validation passes completely and successfully?
Yes, it's all or nothing: either validation fails and nothing is pushed into
the model(s), or validation succeeds and all models are updated.
is myFormComponent.getConvertedInput() a bad practice?
It's not very common but there are special cases where its useful, e.g.
http://stackoverflow.com/questions/7650104/wicket-date-range-from-to-validation
Sven
On 04/24/2012 11:58 PM, Russell Pitre wrote:
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]