public FloatPrefixFormField(String name, String designation, int minLength, int maxLength, boolean mandatory) {
super(name, designation, minLength, maxLength, mandatory);
}
public InvalidRequest validateRequest(Request request) {
InvalidRequest invalid = super.validateRequest(request);
String field = request.getString(_prefixName + name);
if (invalid == null) {
if ((field == null || field.trim().equals("")) && optional) {
return null;
}
try {
NumberFormat.getNumberInstance().parse(field);
if (field.indexOf('.') != -1) {
throw new ParseException("Encontrei um . num float", 0);
}
} catch (ParseException e) {
return new InvalidRequest(_prefixName + name, _prefixDesignation + designation + " dever� ser num�rico (eventualmente com parte decimal, separada por v�rgula)");
}
}
return invalid;
}