I personally do something like this, though I have to wonder is it bad
practice?
I get the content with a request and use the callbacks to do what I
need, seems to work fine. Though I wonder about observer clean up
since I don't unregister them anywhere.
function getSelectsForm()
{
new Ajax.Request('dsp_ProjSelects.cfm?'+cfSession,
{
method: 'get',
onSuccess: loadSelectsForm,
onComplete: attachSelectsFormObservers,
onFailure: function(r) {
throw new Error( r.statusText );
}
}
);
}
function loadSelectsForm(transport)
{
var htmlBlock = transport.responseText;
Element.update(idSelectsDIV,htmlBlock);
}
function attachSelectsFormObservers()
{
// Buttons on the form that was loaded
Event.observe('buttonGetProjectsList','click',
getProjectsList, false);
Event.observe('buttonAddProjectForm','click', addProject, false);
Event.observe('buttonClearForm','click', clearSelectsForm, false);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---