Announcement

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

    Client-side validator not re-run if entry changed back to stored value

    Hi Isomorphic,

    please see this video of a ListGrid with validator (ds.xml validator that runs on the client as well) (using v11.1p_2018-02-28):
    Click image for larger version

Name:	Client-side validator not re-run if entry changed back to stored value.gif
Views:	71
Size:	68.0 KB
ID:	252042
    Steps are:
    • Double click to edit
    • Add space to the end of the name
    • Enter (-> validation error added, OK)
    • Double click to edit
    • Remove space from the end of the name
    • Enter(-> validation error stays, not OK)
    As you can see, the validation error is still present after the last step. I'd expect it not to be there, as the value was changed back to the original value.

    Please see this testcase (BuiltInDS-based):

    BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("25%");
            w.setHeight("35%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("Client-side validator not re-run if entry changed back to stored value" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final ListGrid employeesGrid = new ListGrid(DataSource.get("employees"));
            employeesGrid.setHeight100();
            employeesGrid.setAutoFetchData(false);
            employeesGrid.setCanEdit(true);
    
            ListGridField employeeId = new ListGridField("EmployeeId");
            ListGridField name = new ListGridField("Name");
            ListGridField gender = new ListGridField("Gender");
            ListGridField job = new ListGridField("Job");
    
            employeesGrid.setFields(employeeId, name, gender, job);
            employeesGrid.setSort(new SortSpecifier[] { new SortSpecifier(name.getName(), SortDirection.ASCENDING) });
            employeesGrid.fetchData(new AdvancedCriteria(new Criterion(name.getName(), OperatorId.STARTS_WITH, "A")));
            w.addItem(employeesGrid);
            w.show();
        }
    }
    employees.ds.xml change:
    Code:
            <field name="Name" title="Name" type="text" length="128">
                <validators>
                    <validator type="regexp" expression="^[^ \t].*[^ \t]$">
                        <errorMessage>Whitespace not allowed at beginning or end"</errorMessage>
                    </validator>
                </validators>
            </field>
    Best regards
    Blama

    #2
    Hi Isomorphic,

    did you alread look into this one?

    Best regards
    Blama

    Comment


      #3
      We're looking into it now.

      Comment


        #4
        This has been addressed back to SGWT 5.1p/SC 10.1p, and the fix will be in the nightly builds dated 2018-03-07 and beyond.

        Note: due to build issues, this only made it into 12.0d for the 2018-03-07 builds. For the older releases, tomorrow's builds (dated 2018-03-08) will pick it up.
        Last edited by Isomorphic; 7 Mar 2018, 16:10.

        Comment

        Working...
        X