Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4883

Clients.submitForm does not submit form

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 9.6.0
    • 9.5.1.2, 9.6.0
    • ZK Client Engine
    • Security Level: Jimmy
    • Original post:

      Java 14
      Spring Boot 2.4.5
      ZKSpringBoot 2.3.0
      ZK 9.5.1.2
      Firefox 88
       

      Matt:

      Not reproduced, but receives a different deprecation warning (see comments)

      Steps to Reproduce

      Create a form and submit it using Clients.submitForm().

      Example :

      ZUL :

       

      <button label="Submit" onClick="@command('submitForm',form=myForm)"/>
      <h:form id="myForm" name="myForm" action="" method="post" xmlns:h="http://www.w3.org/1999/xhtml"/>

       

      ViewModel :

      @Command
      public void submitForm(@BindingParam("form") Form form) {
          try {
              form.setDynamicProperty("action", "https://anyurl");
              final String xmlContent = '<any xml content>';
              final Input inputXml = new Input();
              inputXml.setParent(form);
              inputXml.setDynamicProperty("type", "hidden");
              inputXml.setDynamicProperty("name", "xmlContent");
              inputXml.setValue(xmlContent);
              final Input inputEncoding = new Input();
              inputEncoding.setParent(form);
              inputEncoding.setDynamicProperty("type", "hidden");
              inputEncoding.setDynamicProperty("name", "encoding");
              inputEncoding.setValue("utf-8");
              log.info("before submit");
              Clients.submitForm(form);
              log.info("after submit");
          } catch (JAXBException e) {
              logger.error("problem to submit form");
              e.printStackTrace();
          }
      }

      Current Result

      Nothing happens, no error/exception.

      It works with previous versions of ZK but not with 9.5.1.2.

      Expected Result

      Expected form to be submitted using ZK 9.5.1.2.

      Debug Information

      Example above displays :

       

      > before submit
      > after submit
      

       

      But form is not submitted.

      Workaround

      Downgrade to ZK version 9.5.1.1

       

      Additional information

      Tested by Matt, cannot reproduce but receive a Deprecation message from the same method call, regarding the same workflow.

      Possible environment differences between deprecated / blocked by security options

      Since deprecated, should investigate replacement by a different API / workflow if possible before it is completely removed from browsers.

        1. 9.5.1.2.png
          9.5.1.2.png
          173 kB
        2. image-2021-04-29-14-11-34-866.png
          image-2021-04-29-14-11-34-866.png
          60 kB
        3. test-ZK-4883.zip
          4 kB
        4. error_zk_submit_form.png
          error_zk_submit_form.png
          106 kB
        5. image-2021-05-06-11-05-31-480.png
          image-2021-05-06-11-05-31-480.png
          95 kB

            rudyhuang rudyhuang
            YannUnil YannUnil
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Time Spent - 4 hours Remaining Estimate - 1 day, 4 hours
                1d 4h
                Logged:
                Time Spent - 4 hours Remaining Estimate - 1 day, 4 hours
                4h