}
// submit /////////////////////////////////////////////
public void handleSubmit(VariableScope variableScope, VariableMap values, VariableMap allValues) {
TypedValue submittedValue = (TypedValue) values.getValueTyped(id);
values.remove(id);
// perform validation
for (FormFieldValidationConstraintHandler validationHandler : validationHandlers) {
Object value = null;
if(submittedValue != null) {
value = submittedValue.getValue();
}
validationHandler.validate(value, allValues, this, variableScope);
}
// update variable(s)
TypedValue modelValue = null;
if (submittedValue != null) {
if (type != null) {
modelValue = type.convertToModelValue(submittedValue);
}
else {
modelValue = submittedValue;
}
}
else if (defaultValueExpression != null) {
final TypedValue expressionValue = Variables.untypedValue(defaultValueExpression.getValue(variableScope));
if (type != null) {
// first, need to convert to model value since the default value may be a String Constant specified in the model xml.
modelValue = type.convertToModelValue(Variables.untypedValue(expressionValue));
}
else if (expressionValue != null) {
modelValue = Variables.stringValue(expressionValue.getValue().toString());
}
}
if (modelValue != null) {
if (id != null) {