Popupdatefield maxlength restriction

Hi All,
I have a popupdatefield.I want to set the max length for that.
For example,If i enter more than 10 characters .it should not allowed.
I think there is no maxlength property is available for popupdatefield.
I have tried like the below code

public static PopupDateField createDateField(Object propertyId, int state)
{

    PopupDateField date = new PopupDateField("")
    {
        
        <<handleUnparsableDateString() code>>
    
    date.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
             Object dateObj = (Object) event.getProperty().getValue();
             String dateString = dateObj.toString();
             System.out.println("Date String::" + dateObj.toString());
            if(dateString.length()!=10)
            {
                System.out.println("Date String::" + dateString + "Should be 10");
            }
            
        }
    });
   
}

Is there any workaround solution there?
Please help me in this regard.

Regards,
Gopi N

Hi Gobi,

What do you want to achieve? Nicer feedback for the user if the conversion fails or that the user cannot type more than 10 characters? If it’s the first one, then you can do that by overriding the handleUnparsableDateString() -method like you have done already. The second one should be done on client side. You could create a component extension to do it. You can find more information about component extensions from the book of Vaadin
https://vaadin.com/book/vaadin7/-/page/gwt.extension.html