View Full Version : NumberField validation

1 Jun 2009, 3:21 AM

I have a question with validating a NumberField in a form. I would like to have the NumberField automatically validated when the user types in a value more than Integer.MAX_VALUE. However, the NumberField doesn't display the red crooked line or the error tooltop on the field even if I enter a much bigger amount.

I was thinking that maybe it's because of this line of code in NumberPropertyEditor class, convertStringValue() method: return Integer.valueOf(value);

When this is called during validation, it automatically returns a fixed value of 2147483647 all the time. Therefore, the validator doesn't detect that the actual entered value was greater than Integer.MAX_VALUE.

Is there another way to make the error appear automatically, and not automatically convert the entered value to 2147483647?

Here's a code snippet:

this.maxLogDirTextField = new NumberField();
this.maxLogDirTextField.setId("SettingsMaxLogDir_" + projectID);
this.maxLogDirTextField.setFieldLabel("Max Number of Active LogDir");
this.maxLogDirTextField.setLabelStyle("width: 200;");