tags:

views:

207

answers:

1

I'm creating a dialog with YAHOO.widget.Dialog. The dialog is fired off by clicking on a link, and the function the link uses specifies parameters that finally get added to a postdata option like so:

  var myDialog = new YAHOO.widget.Dialog("myDialog", {
    fixedcenter: true,
    // postmethod: "form",
    postdata: propString
  });

This works just fine, but now I need to do the same thing but using "form" instead of "async" - and there's no postdata for form submissions.

What's the right way to do this?

(YUI 2.7.0)

A: 

Here is an example:

var dlg= new YAHOO.widget.Dialog("objectDlg",{
close: false,
draggable: false,
hideaftersubmit: false,
modal: true,
fixedcenter: true,
visible: false,
constraintoviewport: true,
dataURL: saveObjectURL,
buttons: [{'text': 'Save',handler: function(){
    var postdata= ...
    this.cfg.setProperty("postdata", postdata); //this is important
    this.submit();}, 'isDefault': false},
    {'text': 'Cancel', handler: function() {this.cancel();}, 'isDefault': true}] });
dlg.render(document.body);

Hope it is helpful

foxgem