newEntry = FALSE;
} else {
newEntry = "";
}
}
final FieldEditState fieldState = formState.createField(fieldName, newEntry);
Consent consent = null;
if (!parameters2.get(i).isOptional() && newEntry.equals("")) {
consent = new Veto(parameters2.get(i).getName() + " required");
formState.setError("Not all fields have been set");
} else if (parameters2.get(i).getSpecification().getFacet(ParseableFacet.class) != null) {
try {
final ParseableFacet facet = parameters2.get(i).getSpecification().getFacet(ParseableFacet.class);
Localization localization = IsisContext.getLocalization();
final String message = parameters2.get(i).isValid(object, newEntry, localization);
if (message != null) {
consent = new Veto(message);
formState.setError("Not all fields are valid");
}
final ObjectAdapter entry = facet.parseTextEntry(null, newEntry, localization);
fieldState.setValue(entry);
} catch (final TextEntryParseException e) {
consent = new Veto(e.getMessage());
formState.setError("Not all fields are valid");
}
} else {
fieldState.setValue(newEntry == null ? null : context.getMappedObject(newEntry));
}
if (consent != null && consent.isVetoed()) {
fieldState.setError(consent.getReason());
}
}
if (formState.isValid()) {
final ObjectAdapter[] parameters = getParameters(action, formState);