Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1203

Subform Javascript does not work when subform is contained within an iterator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.7
    • SubForm
    • None

    Description

      The SubFormRenderer.createPartialSubmitJS takes in only the last component of the ID as such cannot work in a repeating environment
      e.g.

      <tr:iterator ...>
      <s:subform id="a" >
      ...
      <t:commandButton actionfor="a" .../>
      ...
      </s:subform>

      </tr:iterator>

      Results in things like

      <input ...>
      <script type="text/javascript">function a_submit() {
      var form = document.forms['questionsForm'];
      var el = document.createElement("input");
      el.type = "hidden";
      el.name = "org.apache.myfaces.custom.subform.submittedId";
      el.value = "a";
      form.appendChild(el);
      form.submit();
      }
      </script>

      <input ..>
      <script type="text/javascript">function a_submit() {
      var form = document.forms['questionsForm'];
      var el = document.createElement("input");
      el.type = "hidden";
      el.name = "org.apache.myfaces.custom.subform.submittedId";
      el.value = "a";
      form.appendChild(el);
      form.submit();
      }
      </script>
      <input ...>
      <script type="text/javascript">function a_submit() {
      var form = document.forms['questionsForm'];
      var el = document.createElement("input");
      el.type = "hidden";
      el.name = "org.apache.myfaces.custom.subform.submittedId";
      el.value = "a";
      form.appendChild(el);
      form.submit();
      }
      </script>

      as you can see the function name is repeated 3 times
      function a_submit()

      {...}
      function a_submit(){...}

      function a_submit()

      {...}

      And the value of the hidden field is not distinguishable.

      The resolution would be to use the clientID with : swaped out as the function name, the value of the hiddenField, and the value checked to see if this field was submitted.

      Thanks,

      David.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dwat001 David Waters
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: