Loading ...
Sorry, an error occurred while loading the content.
 

[ydn-javascript] setForm in asyncRequest is posting wrong data

Expand Messages
  • Martin Tschofen
    I ve got a page (with a datatable) that pulls up two different forms via an XHR request into an overlay. The first form creates an object closes the overlay
    Message 1 of 1 , Sep 3, 2008
      I've got a page (with a datatable) that pulls up two different forms via an XHR request into an overlay.

      The first form creates an object closes the overlay and updates the datatable.
      The second form lets users update an object in the datatable.

      I run the create form without a hitch. I then run the update form, the form loads in the overlay (all the html from the previous form is replaced). All the form values appear to be correct. The action of the form points to the update call on the back end.

      However, here's the weird part, when I setForm, the data returned contains values of the previous form. And to make things weirder, only if I run it immediately after the create form.

      Here's the code that submits the forms (tar is the save button):
                  if(tar.form != null && (tar.type == "submit" || tar.type == "button" || tar.type == "reset" || tar.tagName == "BUTTON")){
                      var x = YAHOO.util.Connect.setForm(tar.form);
                      var act = tar.form.action + '&rendertype=enhanced';//IE bug fix
                      YAHOO.util.Connect.asyncRequest('POST', act, {success: successCB, failure: errorCB, argument: arg});
                      CMW.Portlet.Callout.setBody(CMW.Client.LOADING_MSG);
                      return true;
                  }

      When I look at var x or at the consol in firebug at the post section, it shows that the post section contains some value of the initial create form.
      Any idea what even to try?
    Your message has been successfully submitted and would be delivered to recipients shortly.