Hi!
Once again I ask for help, I can not solve the problem myself.
Required:
When editing a page depending on the values in List1
, dynamically generate List2
List 1
:
{{velocity}}
#if($context.action == 'edit')
{{html wiki="true"}}
<select id="List1">
<optgroup label="Group1">
<option>Item11</option>
<option>Item12</option>
<option>Item13</option>
<option>Item14</option>
</optgroup>
<optgroup label="Group2">
<option>Item21</option>
<option>Item22</option>
</optgroup>
</select>
#set($selVal = $request.getParameter('selVal'))
$doc.set('hdwType', $selVal)
$doc.save()
{{/html}}
#else
$value
#end
{{/velocity}}
List 2
Type: Database List based oh HQL Query.
On change event in List1
send the selected value as a parameter in the HQL Query of List2
.
Part of JSX Code:
hdwTypeSelect.change(function() {
sendTypeValue(this.value);
});
function sendTypeValue(typeValue) {
var UrlParams = {'xpage': 'plain','outputSyntax': 'plain', 'typeValue': typeValue};
new Ajax.Request(docUrl, {
parameters: UrlParams,
onSuccess : function(response) {
getTypeValue();
}
});
}
function getTypeValue() {
/*temporarily hardcoded some values*/
#set ($document = $xwiki.getDocument('HardwareInventory.testPage1'))
#set ($resp = $request.getParameter("typeValue"))
// Questions:
// 1. How to debug $resp? Alert('$resp') doesn't work.
// 2. How to access the property 'Hibernate Query'? Is programming rights required?
// 3. Is implementation correct generally?
}
Thanks.