Stepper component

Hi,

I am using a IntStepper and want to block the user to enter values more than 365. As per the below code user should not be able to manually enter any value more than the Max value(365) and less than the Min value(1), but it still allows values like 800 etc.

public Component getStepperValue()
{
IntStepper intStepper = new IntStepper();
intStepper.setValue(1);
intStepper.setStepAmount(1);
intStepper.setMaxValue(365);
intStepper.setManualInputAllowed(true);
intStepper.setInvalidValuesAllowed(false);
return intStepper;

}

I guess the intStepper.setInvalidValuesAllowed(false); is not working properly for me. I tried adding a server side validator to get the manually entered values and checking if that is > than the max value. But if the value goes > than the Max value, I am not able to get the manually entered value from getValue() .

Any suggestion, how to make this work?

Thanks in advance.