Announcement

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

    WARN: form has explicitly specified value for field.

    SmartGWT EE 8/31 nightly (although this was happening before). I have a ValuesManager with various forms as members. I use ValuesManager.editRecord(myRecord) to populate all of the forms from an existing record. When I use ValuesManager.saveData() the development mode console shows a long list of warnings that ...
    Code:
    ValuesManager myValuesManager: Member Form: [myForm1] has explicitly specified value for field[s] 'aField', but has no item associated with this fieldName. Ignoring this value. Values may be set for fields with no associated form item directly on the valuesManager via valuesManager.setValues(), but not on member forms. See ValuesManager documentation for more info.
    The warnings appear, for each form, for all of the fields in the datasource that are not part of that form. I'm not setting values explicitly on any of the forms. Only via the ValuesManager. Everything otherwise seems to work except that the console fills up with a load of messages. And the errors only appear when ValuesManager.saveData() is called.

    #2
    A quick check of samples is not reproducing this warning. Can you show sample code to reproduce it?

    Comment


      #3
      I've tried to create a simple example but of course it doesn't happen in my simple example. Can you give me any tips on where to look based on the conditions that would cause that message to be sent?

      Comment


        #4
        Basically, providing values at init, via defaultValue, or via setValue() to a member form. But you denied doing any of those things :)

        Maybe you are setting defaultValue in the .ds.xml file? Not technically valid, and would be seen/evaluated by member forms, causing this warning.

        Comment


          #5
          Thanks. I did finally spot the code that was using setValue() on FormItems when it should have been calling setValue() on the ValuesManager. I think I was led astray by the fact that the message didn't appear until calling ValuesManager.saveData() instead of on the call to FormItem.setValue().

          Comment


            #6
            Although you already found a solution, I just wanted to add my experience...

            I got your same message but when I called ValuesManager.addMember(DynamicForm). After trying to find where I was setting the values in question, in a desperate attempt, I tried calling DynamicForm.setValuesManager(ValuesManager) instead. The warning disappeared after that!

            Comment


              #7
              I will second that. Setting the ValuesManager on the DynamicForm, instead of the other way around, stopped the errors from happening.

              Comment


                #8
                If anyone can provide sample code that causes a spurious warning here, let us know.

                Right now it appears that the warning is correct, and if there's a bug, it's that the bad usage is not caught if you change the order of joining forms and valuesManager.

                Comment


                  #9
                  I don't have the time to completely isolate what causes it, but I can give you more specifics. I have four forms linked to a ValuesManager. One of the forms gets those warnings from the manager. The fields that it is complaining about are in a different form and are not referenced in any way from the other forms, particularly not in the one with the error. The one form that is getting the error has some FormItems that are not in the datasource and I call setValue on them. Could that be the problem even though it's a different field name? Should I be setting the value of non-datasource fields through the manager as well?

                  Comment


                    #10
                    Right, set all values through the ValuesManager. So not a bug, a usage issue as we guessed.

                    Comment


                      #11
                      That's a real pain. This is caused by my solution to:
                      http://forums.smartclient.com/showthread.php?t=9803

                      The FormItem that tracks the radio buttons is not going to know about the ValuesManager, it just knows about the items it is keeping track of. So it will have to have knowledge about whether the form is part of a manager or not.

                      Also, that error message is strangely imprecise! Why is it picking apparently random (but always the same two) fields to complain about instead of the ones I'm actually setting?

                      Comment


                        #12
                        If you think the error message is incorrect, once again please show a test case.

                        Your other problem should have been solved using CanvasItem, which provides notifications for when values are applied to the item. See samples.

                        Comment


                          #13
                          The error message is definitely incorrect, because I'm not touching those fields anywhere, but whatever.

                          I tried using a CanvasItem before, maybe not in this configuration, but there are two issues there. First, it needs to be invisible, which I do know how to solve. But secondly, and more importantly, it still needs to setValue on the other FormItems in different places on the form, which won't solve this error message.

                          Comment


                            #14
                            Setting value after init should not be causing this warning. Again, when you think there's a bug, you need to show test code.

                            Comment


                              #15
                              This worked for me too

                              Originally posted by kevboy View Post
                              Although you already found a solution, I just wanted to add my experience...

                              I got your same message but when I called ValuesManager.addMember(DynamicForm). After trying to find where I was setting the values in question, in a desperate attempt, I tried calling DynamicForm.setValuesManager(ValuesManager) instead. The warning disappeared after that!
                              This solutions worked for me too.
                              Code:
                              //vm.addMember(this);
                              this.setValuesManager(vm);
                              Before the fix I got a lot of warnings, which I feel were incorrect. At the least the warning message seems to have no relation to the fix.

                              Unfortunately I do not have a clear test case that can show this reproducable (cannot share the code of the project that I am working on), and I also don't have time to create one at the moment; sorry.
                              Last edited by thijs; 4 Mar 2013, 07:50.

                              Comment

                              Working...
                              X