Announcement

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

    Event when form is submitted properly

    Can I observe "saveEditorValues" to get an event when a DynamicForm (or ValuesManager) is correctly saved to the server? It seems to be working but is an undocumented feature AFAIK.

    #2
    Yes, check out http://www.smartclient.com/docs/10.0/a/b/c/go.html#method..Class.observe

    Comment


      #3
      My question was not really about observe() but more if the saveEditorValues is the correct method to observe.

      Comment


        #4
        As a follow-up on my earlier question, the result is not satisfying. I have the following situation (please feel free to comment on the way of working in general).

        I have a customer edit form. In it there is a grid with addresses [step 1]. If an address will be edited, a popup shows that allows an user to edit the address details [step 2]. If the form is submitted (either via a button click or pressing Enter), the address details are sent to the server for validation purposes only! On the server the values are checked and the validated record is returned (including extra fields!) [step 3].

        In the addresses grid, I show an "address" field which is the combination of street and number. The "address" field cannot be edited in the popup, but the street and number can. When I validate on the server, I send back the validated record, including the (virtual) address field. When everything is okay, the grid gets updated.

        At the moment I use observe() on the form's "saveEditorValues" but the record that gets passed to it (as first argument), doesn't contain the values as returned by the server [step 4]. I am aware of the "validationURL" functionality but - AFAIK - it submits the form after successful validation and this is not what I want. So that leaves me with the question: can I listen/observe an event/method with the validated record?

        With 4 attached images I try to show what happens.
        Attached Files

        Comment


          #5
          I now observe "saveFormReply" on the form and this works better! But still I'm not sure if this is the way to do this? I get the feeling that it's possible to specify callbacks for the form submittal, but I can't get this to work with the Enter key being pressed.

          Comment


            #6
            I opened this thread some months ago but now I'm facing a problem with it again. As soon as a form is saved AND the form's values are updated with the result from the server, I want to have an event fired.

            I thought I have it working, by firing my own "onSaved" event from DynamicForm's SaveEditorValues' callback. I have another component listening to this event. In it I do form.getValues() and I don't see the updated values yet (when creating new records, the server autofills some fields and I want to use that autofilled value, but it's still undefined).

            Any help would be appreciated, I hope my explanation is clear enough. ;-)

            Comment


              #7
              To keep the question as easy as possible:

              Is there an event/method that I can overrule/observe that fires after a form is submitted (via a roundtrip to the server) and the result of the roundtrip is processed in the form?

              Comment

              Working...
              X