Announcement

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

    DynamicForm: redrawOnChange and canSubmit results in empty values being sent

    I have a form with canSubmit: true. At the same form, a checkbox use redrawOnChange and other FormItems use showIf.

    I noticed that if the checkbox with redrawOnChange receives a click, when I submit the form any fields that were changed by the user will be sent as empty to the server. If the field wasn't changed by the user, the default values are sent normally.

    Is this the expected behavior or is this a bug?

    I'm using v10.1p_2016-02-09/LGPL Deployment. Previously I was using v8.2p_2012-03-23/LGPL Deployment where I didn't experienced this behavior.

    I'm testing it in Chrome 56.0.2924.76 (64-bit).



    #2
    If the field was changed by the user, whatever value the user entered should be sent. This includes a blank value if the user changed a field to a blank.

    Comment


      #3
      Here is a minimal example showing how to reproduce the problem. Just follow the number on each field to know the order in which they should be modified.

      You will notice that when you submit, firstField and secondField will be blank. Calling testForm.getValues() shows their correct values but the values that are sent to server are different.

      If you remove redrawOnChange and showIf and follow the same order, everything should work as expected.

      Code:
      <?php
      if ($_POST) {
          var_dump($_POST);
          die();
      }
      ?>
      <!DOCTYPE html>
      <html>
          <head>
              <!-- Include SmartClient javascript here -->
          </head>
          <body>
              <script>
              isc.DynamicForm.create({
                  action: 'example.php',
                  canSubmit: true,
                  ID: 'testForm',
                  fields: [{
                      type: 'select',
                      name: 'firstField',
                      title: 'Change me (1)',
                      defaultValue: "1",
                      valueMap: {
                          "1": 'Example 1',
                          "2": 'Example 2'
                      }
                  }, {
                      name: 'secondField',
                      redrawOnChange: true,
                      type: 'checkbox',
                      title: 'Click here (2)'
                  }, {
                      name: 'thirdField',
                      type: 'text',
                      title: 'Change me (3)',
                      showIf: 'form.getValue("secondField") == true'
                  }, {
                      type: 'button',
                      name: 'Submit (4)',
                      click: 'if (testForm.validate()) { testForm.submit() }'
                  }]
              })
              </script>
          </body>
      </html>

      Comment


        #4
        I also tested version v11.0p_2017-02-03/LGPL Deployment and it shows the same behaviour.

        Comment


          #5
          This has been fixed for builds dated February 17 and later.

          Comment

          Working...
          X