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

RE: [ydn-javascript] Dialog form's submit sends no POST request

Expand Messages
  • Satyen Desai
    Hi, I don t have any problems running your example code with YUI 2.5.1: http://yuiblog.com/sandbox/yui/v251/examples/container/dialogSubmitSuccessful.html Note
    Message 1 of 2 , May 1, 2008
    • 0 Attachment
      Hi,
      I don't have any problems running your example code with YUI 2.5.1:

      http://yuiblog.com/sandbox/yui/v251/examples/container/dialogSubmitSuccessful.html

      Note that the above page will result in a "405" response when the dialog is submitted, just because the server doesn't allow the POST method, but the submission goes through OK.

      If you have a URL we could look at, that may help.

      If you're already stepping through the code using breakpoints, how far does it get if you step into the submit() method? (the debug, or non-min versions of container/connection will allow you to step through the Dialog submit() method and into connection manager). Do you see the request on the server?

      Thanks,
      Satyen.

      p.s. I tried it with TabView too, although not sure what the intention is with an absolutely positioned, fixed center Dialog inside a Tab View panel.

      p.p.s. The cursor oddity is a Firefox bug

      http://developer.yahoo.com/yui/container/#knownissues
      "Text input/Textarea caret not displayed in Firefox"

      https://bugzilla.mozilla.org/show_bug.cgi?id=167801
      ________________________________________
      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of bradhanebury
      Sent: Thursday, May 01, 2008 12:52 PM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Dialog form's submit sends no POST request

      I have a dialog panel with a simple form but nothing happens when I
      click the 'Submit' button.

      Details:
      - The script gets to the handler: function() { this.submit();} but no
      POST request is ever made.
      - No error messages or warnings
      - All required YUI libraries are included
      - An oddity: when clicking one of the form's input fields (such as Name
      or Address), no cursor is displayed. I can still type in the input
      fields just fine though. Strange as I don't see this in the example's
      dialog.
      - The dialogEditMember html code is contained in a tab. The tab is
      active by default. I wait for onDOMReady before initializing the tabs,
      and then I wait for the tabview's contentReady event before initializing
      the dialog. I'm not sure if this is necessary and I've tried removing
      these options and letting it all run as the browser interprets the code,
      but there was no change.
      - As I mentioned, I can hit the 'Cancel' button and it closes just fine.
      Same with the little 'X' at the top right.
      - I put a breakpoint in the dialog's validate function and it works
      normally and returns true if member_name and member_address are not
      empty

      HTML for dialog. Very straightforward - almost straight from example
      -----------------

      <div id="dialogEditMember">
      <div class="hd">Edit Member Information</div>
      <div class="bd">
      <form name="editMemberForm"
      id="editMemberForm" method="POST" action="members.edit.php">
      <input type="hidden" name="member_id"
      value=""/>
      <label
      for="member_name">Name:</label><input type="text" name="member_name"
      value="" size="32"/>
      <label
      for="member_address">Address:</label><input type="text"
      name="member_address" size="32" value=""/>
      <label
      for="member_email">Email:</label><input type="text" name="member_email"
      size="32" value=""/>
      </form>
      </div>
      <div class="ft"></div>
      </div>

      JAVASCRIPT
      -----------------
      //instantiate the edit member dialog & form
      var editMemberDialog = new
      YAHOO.widget.Dialog("dialogEditMember",
      {
      width: "450px",
      fixedcenter: true,
      visible:false,
      constraintoviewport: true,
      buttons: [
      {text:"Submit", handler: function()
      { this.submit();}, isDefault:true},
      {text:"Cancel", handler: function()
      { this.cancel();} }
      ]
      });

      // Validate the entries in the form to require that name and
      address

      editMemberDialog.validate = function() {

      var data = this.getData();
      if (data.member_name == "" || data.member_address == "") {
      alert("Please enter your name and address.");
      return false;
      } else {
      return true;
      }
      };

      // Wire up the success and failure handlers
      editMemberDialog.callback = {
      success: function(o) {
      alert(o.responseText);
      },
      failure: function(o) {
      alert("Submission Failed: " + o.status);
      }
      };

      editMemberDialog.render();
    Your message has been successfully submitted and would be delivered to recipients shortly.