Announcement

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

    SaveOnEnter with multiple forms and ValuesManager

    I have a data source with a lot of fields and an editing screen that breaks it up into multiple forms on different tabs. All forms use the same DataSource and ValuesManager. When I create each form I use ValuesManager.addMember(myForm) to associate them all with the same manager.

    I have setSaveOnEnter(true) on all of the forms and have overridden DynamicForm.submit() on each form where I call a method that calls saveData() on the ValuesManager. I also have a "Save" button on the layout that calls saveData().

    Also on the layout is a ListGrid tied to the same datasource. When a user clicks on a record in the grid I use ValuesManager.editRecord(event.getRecord()); The values from the selected record appear in all of the various forms tied to the ValuesManager.

    The first of the various forms has a couple of fields that are required="true". If I click the Save button all is well, But if I press Enter in any forms I get this error.
    Code:
    17:24:02.111 [ERROR] [ipgui] 17:24:02.099:XRP1:WARN:validation:isc_VendorMaintenance$11_1:Validation errors occurred for the following fields with no visible form items:
    VVEN:- Field is required
    VNAM:- Field is required
    Both of those fields do have data in them from the selected record. Although it is a WARN message my save method is not being called. So nothing appears to happen from the end user point of view.

    Here is the method I call to create each of the forms, after which I then populate them with the fields for the particular form.
    Code:
    private DynamicForm getStandardForm() {
    
    	DynamicForm stdForm = new DynamicForm() {
    		@Override
    		public void saveData() {
    			saveVendor();
    		}
    	};
    	stdForm.setDataSource(ipMrven);
    	vm.addMember(stdForm);
    	stdForm.setWrapItemTitles(false);
    	stdForm.setSaveOnEnter(true);
    
    	return stdForm;
    }

    #2
    This strongly suggests that whatever form has these fields is not actually a member of the ValuesManager.

    Comment


      #3
      I've verified that all forms are members of the same values manager using the developer console. I've also verified that the form in question does contain the fields and the fields contain the expected values.
      Last edited by jay.l.fisher; 5 Aug 2010, 20:02.

      Comment


        #4
        OK, for this one I think we need you to isolate it to a test case. We've got a number of automated tests all coming up green, so there must be something unique about the particular order you're doing things.

        Comment


          #5
          I'm not sure what to strip out to try to isolate it. All forms in the class are being created by the same getStandardForm() method shown earlier so they all have the same ValuesManager. The entire Canvas and all forms are being built onInit(). Clicking the Save button works so I know ValuesManager.saveData() does what is expected, saving data from all of the various forms.

          It seems like my override of saveData() is not being called when Enter is pressed. But instead form validations are being performed on the individual form. Is there something more than needs to be done to implement SaveOnEnter in this situation?

          Comment


            #6
            Ah - yes, saveOnEnter calls submit(), and submit() is not currently checking for a ValuesManager. This should automatic, however you can intercept this by adding a SubmitValuesHandler to call save on the VM instead.

            Comment


              #7
              Thanks. I'll give that a try. While researching this I notice that I've somehow managed to get a mismatch between client and server versions. I can't recall how to correct this.
              Code:
              === 2010-08-06 08:26:37,036 [0-14] WARN  RPCManager - client/server version mismatch.  Client is version: SC_SNAPSHOT-2010-07-10, server is version: SC_SNAPSHOT-2010-08-03 - mixing different client/server versions is generally not supported.  If you've installed a more recent client version, try clearing the browser cache and reloading the page.
              Whenever I install a new version I follow the same process, replacing the old jars with the new ones and rebuilding the project. Is there something else I should be doing? I've cleared the browser cache many times since the last upgrade. ?

              Comment


                #8
                Full installation steps are here. Aside from browser caching, IDEs sometimes get stale - recall the trick for Eclipse of switching JDK versions and switching back.

                If you've manually copied resources from the sc/ folder (eg ISC_Core.js) to some location, you'd need to update those as well.

                Comment


                  #9
                  Disregard that last note. I now realize where the mismatch comes from. I have been using the nightly EE builds but was recently sent the 2.3 Pro version. I simply copied all of the jars without looking closely. I now have both smartgwtpower.jar and smartgwtee.jar. I thought there wasn't any different between the two. Which should I be using? It seems like there are nightly builds for EE but not for Power and yet Power is the "official" build I get.

                  Comment


                    #10
                    Power is the right build to use. We're setting things up so that customers will be able to download nightlies that are actually Power builds instead of having to download an Enterprise build to try out a nightly.

                    Comment


                      #11
                      I think I'll stick with EE for now since there are numerous references to it in gwt.xml and various includes. I'll get the latest nightly and use that until the nightlies are available for Power.

                      Comment

                      Working...
                      X