PDA

View Full Version : Calling Function from Dialog



ameikle
4 Nov 2006, 9:38 PM
Hi Jack, great work, I absolutely love what you have done.

my question is how do you call a function from within the Basic Dialog demo.

For example, suppose I want to call a validation function
when a user clicks the submit button, how do i reference the function.

--Thanks

jack.slocum
5 Nov 2006, 3:40 AM
Suppose you are in a function called createDialog:


var form = getEl('form-id');
var dlg = new BasicDialog(...);

var handleSubmit = function(){
... // validate stuff
YAHOO.util.Connect.setForm(form.dom);
YAHOO.util.Connect.asyncRequest(...);
dlg.hide();
};
dlg.addButton('Submit', handleSubmit);