Hi steve,
My updateTypesList function again:
require(DATAFACE_SITE_URL+'/js/ajax.js');
var types_http = null;
var type_group = null;
/**
* updateTypesList
* This function is to be assigned in the onchange handler for the group types select list.
*/
function updateTypesList(type_groups_select){
// type_groups_select is a reference to the type_groups select list
var selectedGroup = type_groups_select.options[type_group.selectedIndex].value;
var url = DATAFACE_SITE_HREF +'?-action=get_types&type_group='.escape(selectedGroup);
types_http.open("GET", url);
types_http.onreadystatechange = handleUpdateTypesList;
// Assign the handleUpdateTypesList function as a handler to be called when the HTTP object receives a response from the server
type_group = type_groups_select;
// Save a reference to the group types select list in the http object so that it can be accessed from the handleUpdateTypesList function
types_http.send(null);
}
I found out that already in the first line:
var selectedGroup = type_groups_select.options[type_group.selectedIndex].value;
my firefox error-console tells me that type_group has no properties. I can do an alert("" +type_group+ "") above this line and get null which is defined above and so it works.
If I put the same alert after this line nothing will be returned when changing the select. Even if I put alert("Hello") there, nothing happens. It seems to me that this line has a mistake in it but could not figure out where it might be. I suppose, this line should return the Index of my value, right? Cause there are 5 values, it should return either 1,2,3,4 or 5. But it does not.
It also seems that the script stops here because I never get a changed URL when selecting something from my type_groups select. The URL stays like
http://pathtomyapp/index.php?-action=new&-table=event It is somehow frustrating.
Again also the relevant part of my fields.ini of table event:
[L_GID]
widget:label = "Ereignisgruppen ID"
widget:description = "Die Ereignisgruppen ID des Ereignisses"
widget:type = "select"
vocabulary = "list_event_group"
widget:atts
nchange="updateTypesList(this);"
[L_TID]
widget:label = "Ereignistyp ID"
widget:description = "Die Ereignistyp ID des Ereignisses"
widget:type = "select"
vocabulary = "list_event_type"
My valuelists.ini
[list_event_group]
__sql__ = "select l_gid, type_group from list_event_group"
[list_event_type]
__sql__ = "select l_tid, L_GID, type from list_event_type"
My relationships.ini
[list_event_group]
list_event_group.l_gid = "$L_GID"
[list_event_type]
list_event_type.l_tid = "$L_TID"
My get_types.php
Is this all correct so far? Do you have another idea, what could be wrong?
Thank you
Markus