By the way, (since I can't respond directly to my August post), here is the
solution I finally worked out for HQL-driven, dependent selection lists,
should anyone else find it useful:
<script language="JavaScript" type="text/javascript">
<!--
function loadSubcats(catsubcat) {
var jsloadlist = document.getElementById("selcat").value;
var actiongoto = "../apps/altdblcattest?catkey=" + jsloadlist;
document.location = actiongoto;
return (document.location);
theForm.submit();
}
//-->
</script>
<form name="catsubcat" method="POST"
onSubmit="document.location=loadSubcats(this); return false">
<%
loadlist = request.getParameter("catkey");
if (!loadlist) { loadlist = "null" };
remsubcat = request.getParameter("remsubcat");
if (!remsubcat) { remsubcat = "" };
%>
1 Add/Change Category
<table>
<tr>
<td>
<select id="selcat" name="selcat"
onchange="loadSubcats()">
<%
println "<option value=\"error\">Select a
category</option>";
sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='XWiki.NavCatClass' and obj.name not like '%ClassTemplate'
order by doc.fullName";
sqlcat = xwiki.searchDocuments(sql)
for (item in sqlcat)
{
optcat = xwiki.getDocument(item)
selectvalue = optcat.name
if (!selectvalue.compareTo(loadlist)) { recall = " selected"; }
else { recall = ""; }
println "<option value='" + selectvalue + "'" + recall +
">" +
optcat.title + "</option>";
}
%>
</select>
</td>
<td>
<select id="selsubcat" name="selsubcat">
<%
println "<option value=\"error\">Select a
subcategory</option>";
sql = ", BaseObject as obj, StringProperty as prop where
obj.name=doc.fullName and obj.className='XWiki.NavSubCatClass' and obj.name
not like '%ClassTemplate' and obj.id=prop.id.id and
prop.id.name='parentkey'
and prop.value='${loadlist}' order by doc.name";
sqlsubcat = xwiki.searchDocuments(sql)
for (item in sqlsubcat)
{
optsubcat = xwiki.getDocument(item);
remselectvalue = optsubcat.name
if (!remselectvalue.compareTo(remsubcat)) { recall = " selected"; }
else { recall = ""; }
println "<option value='" + optsubcat.name + "'" +
recall + ">" +
optsubcat.title + "</option>";
}
%>
</select>
</td></tr>
</table>
</form>
Of course, this solution is only partial. On it's own page, it works. The
rest of the implementation depends on your context (e.g., how to write
values to the database).
:)
_________________________________________________________________
The next generation of Search—say hello!
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FOR…