Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DateItem dropdowns re-sized on validation failure

    We have a DateItem with a CustomValidator. When validation fails and a message is shown next to the form item, the select boxes are resized and the values can't be seen clearly. I have attached a screen shot.

    We are using SmartGWT LGPL 2.4, with GWT 2.1. We see the problem in IE6, IE8 and Firefox 4.0.1

    The developer console does not show any messages with the default logging levels.

    Here is a stand alone test case

    Code:
    public class Sandbox implements EntryPoint {
    
    	private static boolean valid = false;
    
    	public void onModuleLoad() {
    
    		DateItem dateItem = new DateItem();
    		dateItem.setTitle("Date");
    		dateItem.setValidators(new MyValidator());
    		dateItem.setValidateOnChange(true);
    		dateItem.setErrorOrientation(FormErrorOrientation.BOTTOM);
    		dateItem.setShowErrorIcon(true);
    		dateItem.setShowErrorText(true);
    		dateItem.setShowErrorStyle(true);
    
    		final DynamicForm form = new DynamicForm();
    		form.setItems(dateItem);
    
    		VLayout vLayout = new VLayout();
    		vLayout.setMembersMargin(10);
    		vLayout.addMember(form);
    
    		vLayout.draw();
    	}
    
    	private static class MyValidator extends CustomValidator {
    
    		private MyValidator() {
    			setErrorMessage("You have chosen an invalid date");
    		}
    
    		@Override
    		protected boolean condition(Object value) {
    
    			boolean result = valid;
    
    			if (valid) {
    				valid = false;
    			} else {
    				valid = true;
    			}
    
    			return result;
    		}
    
    	}
    }
    Any advice on how to preserve the date picker layout while the validation error is displayed? Thanks for your help.
    Attached Files

    #2
    The problem also happens with the out-of-the-box validator so it's not related to the way we are using custom validator:

    Code:
    // dateItem.setValidators(new MyValidator());
    
    DateRangeValidator validator = new DateRangeValidator();
    validator.setMax(new Date());
    dateItem.setValidators(validator);

    Comment

    Working...
    X