I think I *almost* have it working. But not quite. My get_projects
method is working as expected and the initial select for projects gets
populated with the proper options.
But init_client_selector never gets called, as evidenced by the fact
that I do not see the "alert". Consequently there it never listens for
the onchanged signal. How is init_client_selector supposed to get
called?
Here is the relevant part cut and pasted from
HEAD><META CONTENT="text/html; charset=utf-8"
HTTP-EQUIV="Content-Type">
<SCRIPT SRC="/tg_widgets/turbogears/js/MochiKit.js"
TYPE="text/javascript">
</SCRIPT>
<SCRIPT>
var conn = MochiKit.Signal.connect;
function client_id_changed(event) {
var client_id = event.target().value;
var def = doSimpleXMLHttpRequest('/get_projects',
{client_id : client_id});
def.addCallback(function(req) {
var projects = evalJSONRequest(req).projects;
var projects_select =
currentDocument().forms['myform'].elements['projects'];
replaceChildNodes(projects_select,
map(function(project) {
return OPTION({value : project.id},
project.projectDesc);
}, projects));
});
}
function init_client_selector() {
alert("Running")
conn(currentDocument().forms['myform'].elements['myform_client_id'],
'onchange', client_id_changed);
};
conn(window, 'onload', client_id_changed);
</SCRIPT>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---