Wrong error message when form is validated [message #1271072] |
Fri, 14 March 2014 07:20 |
Fredrik Möller Messages: 15 Registered: April 2013 |
Junior Member |
|
|
In my application there is an AbstractTableField with the columns defined as displayed by the screenshot:
When I try to save the form i get an error as displayed in the screenshot.
Code setup:
The Gleisgruppe column is configured as Mandatory as below:
@Override
protected boolean getConfiguredMandatory() {
return true;
}
Besides from this I do have a custom validation that checks that the value in the Gleisgruppe column do not occur more than once.
In my scenario I would expect my custom error message rather than the "Mandatory" error message
Is this a known problem, that if you set the error status of the Cell object of the column with the following code, you will end up with the "Mandatory error message" and not your own error message.
IProcessingStatus status = new ProcessingStatus("Gleisgruppe already configured in another Fahrzeit", ProcessingStatus.ERROR);
rowFromTable.getCellForUpdate(gleisGruppeColumn).setErrorStatus(status);
Kind regards
Fredrik Möller
[Updated on: Fri, 14 March 2014 07:21] Report message to a moderator
|
|
|
Re: Wrong error message when form is validated [message #1271170 is a reply to message #1271072] |
Fri, 14 March 2014 12:24 |
Fredrik Möller Messages: 15 Registered: April 2013 |
Junior Member |
|
|
Hello!
I have debugged a little and it looks like the following section of code from the class: org.eclipse.scout.rt.client.ui.form.AbstractForm
@Override
public void validateForm() throws ProcessingException {
m_currentValidateContentDescriptor = null;
if (!execCheckFields()) {
VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
veto.consume();
throw veto;
}
if (!getHandler().onCheckFields()) {
VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
veto.consume();
throw veto;
}
// check all fields that might be invalid
final ArrayList<String> invalidTexts = new ArrayList<String>();
final ArrayList<String> mandatoryTexts = new ArrayList<String>();
P_AbstractCollectingFieldVisitor<IValidateContentDescriptor> v = new P_AbstractCollectingFieldVisitor<IValidateContentDescriptor>() {
@Override
public boolean visitField(IFormField f, int level, int fieldIndex) {
IValidateContentDescriptor desc = f.validateContent();
if (desc != null) {
if (desc.getErrorStatus() != null) {
invalidTexts.add(desc.getDisplayText() + ": " + desc.getErrorStatus().getMessage());
}
else {
mandatoryTexts.add(desc.getDisplayText());
}
if (getCollectionCount() == 0) {
collect(desc);
}
}
return true;
}
};
is involved. The IValidateContentDescriptor in use in my scenario is the following: org.eclipse.scout.rt.client.ui.form.fields.tablefield.ValidateTableFieldDescriptor and this has the following implementation of the getErrorStatus method is:
@Override
public IProcessingStatus getErrorStatus() {
return null;
}
That would problably explain the incorrect errormessage.
[Updated on: Fri, 14 March 2014 12:24] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03617 seconds