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

Using setForm with multiple submit buttons?

Expand Messages
  • j_s_shirley
    I m building up a nice little YUI-based widget set, but me and my team have encountered an odd problem. In one form, we have multiple submit buttons that are
    Message 1 of 3 , Apr 2, 2007
    • 0 Attachment
      I'm building up a nice little YUI-based widget set, but me and my team
      have encountered an odd problem.

      In one form, we have multiple submit buttons that are designed to
      perform a different action -- nothing fancy. Without the YUI async
      submit, it works as expected.

      I hitch in the submit code (Event is set to YAHOO.util.Event):
      Event.onAvailable(formElement, function(browser) {
      if ( this.async ) this.async.value = 1;
      Event.on(this, "submit", browser.processFormSubmit, browser, this);
      }, this);

      Then In the processFormSubmit method:
      ImageBrowser.prototype.removeImage = function(ev, browser) {
      // "this" is the form object.
      YAHOO.util.Connect.setForm(this);
      YAHOO.util.Connect.asyncRequest(
      this.method, this.action, browser.refreshCallback);
      }

      It is submitting the form, but it _always_ set the submit action to
      the first submit listed in the markup. I've looked at the source for
      setForm in connection/connection-debug.js and it seems that it just
      blindly clobbers any subsequent form submits:

      case 'submit':
      if(hasSubmit == false){
      this._sFormData += encodeURIComponent(oName) + '=' +
      encodeURIComponent(oValue) + '&';
      hasSubmit = true;
      }
      break;

      So, it certainly seems like I'm not using setForm properly -- but I
      wonder if there is a way to do what I want here? It seems like this
      could be the source for a number of hard-to-track down bugs.

      Thanks for your time,
      -Jay
    • tssha
      ... This is a known limitation of connection manager which will be resolved in the coming release. Have a look at this report:
      Message 2 of 3 , Apr 2, 2007
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "j_s_shirley" <jshirley@...> wrote:
        >
        > I'm building up a nice little YUI-based widget set, but me and my team
        > have encountered an odd problem.
        >
        > In one form, we have multiple submit buttons that are designed to
        > perform a different action -- nothing fancy. Without the YUI async
        > submit, it works as expected.
        >
        > I hitch in the submit code (Event is set to YAHOO.util.Event):
        > Event.onAvailable(formElement, function(browser) {
        > if ( this.async ) this.async.value = 1;
        > Event.on(this, "submit", browser.processFormSubmit, browser, this);
        > }, this);
        >
        > Then In the processFormSubmit method:
        > ImageBrowser.prototype.removeImage = function(ev, browser) {
        > // "this" is the form object.
        > YAHOO.util.Connect.setForm(this);
        > YAHOO.util.Connect.asyncRequest(
        > this.method, this.action, browser.refreshCallback);
        > }
        >
        > It is submitting the form, but it _always_ set the submit action to
        > the first submit listed in the markup. I've looked at the source for
        > setForm in connection/connection-debug.js and it seems that it just
        > blindly clobbers any subsequent form submits:
        >
        > case 'submit':
        > if(hasSubmit == false){
        > this._sFormData += encodeURIComponent(oName) + '=' +
        > encodeURIComponent(oValue) + '&';
        > hasSubmit = true;
        > }
        > break;
        >
        > So, it certainly seems like I'm not using setForm properly -- but I
        > wonder if there is a way to do what I want here? It seems like this
        > could be the source for a number of hard-to-track down bugs.

        This is a known limitation of connection manager which will be
        resolved in the coming release. Have a look at this report:
        http://sourceforge.net/tracker/index.php?func=detail&aid=1670523&group_id=165715&atid=836476

        Regards,
        Thomas
      • j_s_shirley
        ... http://sourceforge.net/tracker/index.php?func=detail&aid=1670523&group_id=165715&atid=836476 ... Thomas, Thanks for the quick response and apologies for my
        Message 3 of 3 , Apr 2, 2007
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "tssha" <tsha@...> wrote:
          >
          >
          > This is a known limitation of connection manager which will be
          > resolved in the coming release. Have a look at this report:
          >
          http://sourceforge.net/tracker/index.php?func=detail&aid=1670523&group_id=165715&atid=836476
          >
          > Regards,
          > Thomas
          >

          Thomas,

          Thanks for the quick response and apologies for my lacking of
          searching there. Can't wait for 2.2.1 :)

          -Jay
        Your message has been successfully submitted and would be delivered to recipients shortly.