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

Re: Preventing YAHOO.widget.Dialog from disappearing

Expand Messages
  • bhatti_shahzad
    I have some javascript validation, but I also have some server side error handling and I would like to keep the dialog open and manually close it (when there
    Message 1 of 3 , May 7, 2007
    • 0 Attachment
      I have some javascript validation, but I also have some server side
      error handling and I would like to keep the dialog open and manually
      close it (when there are no errors). Is there a way to do this?



      --- In ydn-javascript@yahoogroups.com, Nick Fitzsimons <nick@...> wrote:
      >
      > On 7 May 2007, at 03:56:10, bhatti_shahzad wrote:
      >
      > > I am using YAHOO.widget.Dialog to display a form, however when I hit
      > > submit it hides the form. I have some error processing and I would
      > > like the form to be visible if there are any errors and only after
      > > successful action, the form be disappeared. Can anyone help me how do
      > > I do this?
      > >
      >
      > You should have your error handling in the "validate" method and
      > return false if you want the dialog to stay visible.
      >
      > So, for example, using your code to create a dialog thus:
      >
      > > YAHOO.example.container.simpledialog1 = new
      > > YAHOO.widget.SimpleDialog("simpledialog1",
      > > { width: "300px",
      > > fixedcenter: true,
      > > visible: false,
      > > draggable: false,
      > > close: true,
      > > text: "Do you want to continue?",
      > > icon:
      > > YAHOO.widget.SimpleDialog.ICON_HELP,
      > > constraintoviewport: true,
      > > buttons: [ { text:"Yes",
      > >
      > > handler:handleYes,
      > >
      > > isDefault:true },
      > > { text:"No",
      > >
      > > handler:handleNo } ]
      > > } );
      >
      > you could then add:
      >
      > YAHOO.example.container.simpledialog.validate = function() {
      > // your code to check if everything is OK...
      > if (everything_ok) {
      > return true;
      > } else {
      > return false;
      > }
      > }
      >
      > HTH,
      >
      > Nick.
      > --
      > Nick Fitzsimons
      > http://www.nickfitz.co.uk/
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.