ICEmobile
  1. ICEmobile
  2. MOBI-516

Native js interface ice.upload form serialization adding 'undefined' value to input type submit values

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: 1.2 Beta
    • Component/s: Faces, Spring
    • Labels:
      None
    • Environment:
      n/a

      Description


      This was seen in the icemobilespring demo in the Android container. When submitting the buttons form, the value of '[button type]undefined' would be returned. The form post was sending '[button type]undefined'. This was only seen in the container, and not seen when using the browser. This example has a different path for submitting the form when in the container:

      MvcUtil.enhanceForm = function(theForm) {
          //submitting the form will update
          //the containing div with class ajaxzone
          $(document).ready(function () {
              $(theForm).submit(function () {
                  var updateRegion = $(this).closest("div.ajaxzone");
                  if (window.ice && ice.upload) {
                      
                      window.ice.handleResponse = function (data) {
                          updateRegion.html(unescape(data));
                          var msgElem = $("#message");
                          if( msgElem.length > 0 ){
                              $('html, body').animate({ scrollTop:msgElem.offset().top }, 500);
                          }
                      }
                      ice.upload($(this).attr("id"));
                      return false;
                  }
                  ...

      When the code just before the 'if( window.ice ...) was commented out, so that the form submitted normally, the problem went away. So, the only different between this example working and not working, is that when in the container, the example posts through the ice.upload function. So that function, must be serializing the input type submit buttons incorrectly.
                  

        Activity

        Migration created issue -
        Hide
        Greg Dick added a comment - - edited

        The javascript in submitFunction in native-interface.js was refactored to create a serialization tail end part to be appending to the post in the ice.upload function. There were several places in the code where ice.upload is called directly from javascript in the page, and these areas would not pass a serialization tail as an argument, hence the value of undefined.
        A simple solution was to add a guard statement to the upload function to not append undefined values.

        Show
        Greg Dick added a comment - - edited The javascript in submitFunction in native-interface.js was refactored to create a serialization tail end part to be appending to the post in the ice.upload function. There were several places in the code where ice.upload is called directly from javascript in the page, and these areas would not pass a serialization tail as an argument, hence the value of undefined. A simple solution was to add a guard statement to the upload function to not append undefined values.
        Migration made changes -
        Field Original Value New Value
        Reporter Migration [ remote ] User Philip.breau [ philip.breau ]
        Migration made changes -
        Assignee Steve Maryka [ steve.maryka ] Greg Dick [ greg.dick ]
        Migration made changes -
        Fix Version/s 1.2 Beta [ 10344 ]
        Migration made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Greg Dick
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: