Announcement

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

    Partial Validation with DynamicForm

    Hello,
    I'm using SmartGWT 3.1d 2012-09-16 and like to know how to use PartialValidation with DynamicForm bound to a Datasource.

    I have created a DMI Handler server side that will set ValidationMode to PARTIAL before executing the DSRequest:
    Code:
    request.setValidationMode(ValidationMode.PARTIAL.getValue());
    But I can't send the values from DynamicForm, because validation happens on the client side when I call saveData.
    I've tried to disableValidation calling:
    Code:
    form.setDisableValidation(true);
    form.saveData(new DSCallback() { ... });
    But validation is still ocurring.

    What is the right to partially save data, i.e using Partial validation? I couldn't find any pointer in the docs.

    #2
    It seems you might be expecting this feature to "partially save data" - it doesn't do anything like that and we're not sure what partially saving would mean.

    Could you take a step back and explain what you are trying to do?

    Comment


      #3
      Hello,
      I have a rather big form, with more or less 50 fields.
      What I'd like to do is allowing the end user to save the filled in fields without validating the required ones that are still empty on the form.
      For instance, a user fills the fields in the first section of the form, then choose the 'save partial' option. The filled in data will be saved without validating required fields that the user hasn't already filled in the other form's sections.

      Comment


        #4
        Ah, OK.

        Doing anything on the server is too late to affect client validation (as you've realized), and there is no single setting to cause a form to ignore required validators, however, you could iterate over the items and call setRequired(false) to temporarily make all items not required when the "Save Partially" button is pressed.

        Comment


          #5
          Almost there....
          When I call setRequired(false) on FormItems the request goes to the server, but when it gets there it's being fully validated before reaching my DMIHandler where I would set ValidationMode to PARTIAL. This behaviour looks consistent with the "Server Request Flow" in the docs.
          Is there a way to set ValidationMode on the DSRequest on the client side?

          Comment


            #6
            Did you already try setting validationMode to "partial" via the DSRequest argument to dynamicForm.saveData()?

            Comment

            Working...
            X