Announcement

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

    DynamicForm setStopOnError(true) not working

    I am using SmartGWT version 3.0p with FF 16.0.
    I have a DynamicForm with some TextItem objects on it that I am setting some validations on. If there is a validation error, I want to prevent the user from moving about on the screen or clicking anything else unless he first fixes the validation error. I am using setStopOnError(true) but it does not seem to be working.
    Please note I have another screen with a ListGrid and setStopOnError seems to work fine there for ListGridField objects for which similar validations have been set.

    Please help me in understanding why this is not working. I am attaching the complete Java code.
    Code:
    import com.smartgwt.client.widgets.form.DynamicForm;  
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
    import com.smartgwt.client.widgets.layout.VLayout;  
      
    import com.google.gwt.core.client.EntryPoint;  
      
    public class testGWT implements EntryPoint {  
            
        public void onModuleLoad() {
            IntegerRangeValidator irv = new IntegerRangeValidator();
            irv.setMin(0);
            irv.setMax(10);
    
            TextItem min = new TextItem("Min", "Min");
            min.setValidators(irv);
            min.setValidateOnChange(true);
            TextItem max = new TextItem("Max", "Max");
    
            DynamicForm df = new DynamicForm();
            df.setWidth(300);
            df.setNumCols(2);
            df.setWrapItemTitles(false);
            df.setItems(min, max);
            df.setValidateOnChange(true);
            df.setStopOnError(true);
    
            VLayout vLayout = new VLayout();  
            vLayout.setMembersMargin(10);  
            vLayout.addMember(df);  
            vLayout.draw();  
        }
    }
    In the above example, I do not want the user to be able to do anything else unless he fixes a validation error on the "Min" field if the user enters a value outside 0-10. I am however able to focus on "Max" field even if there is a validation error.
Working...
X