Project

General

Profile

« Previous | Next » 

Revision 4377

parameterize the div used for ajax results

View differences:

lib/style/skins/first/search.js
4 4
* @return true/false for form submission
5 5
*****************************************************************************/
6 6
function multipleAssessmentSearch(submitFormObj) {
7

  
7
	
8
	//alert("submitFormObj=" + submitFormObj);
8 9
	//harvest the metadata fields we want to include
9 10
	var metadataObjs = new Array();
10 11
	/*
......
33 34
	
34 35
	var documentObjects = new Array();
35 36
	var index = 0;
36
	if (submitFormObj.docids.length > 1) {
37
		for (var i=0; i < submitFormObj.docids.length; i++) {
38
			if (submitFormObj.docids[i].checked) {
37
	if (submitFormObj.docid.length > 1) {
38
		for (var i=0; i < submitFormObj.docid.length; i++) {
39
			if (submitFormObj.docid[i].checked) {
39 40
				var documentObject = new Object();
40
				documentObject.docid = submitFormObj.docids[i].value;
41
				documentObject.docid = submitFormObj.docid[i].value;
41 42
				
42 43
				for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
43 44
					questionIds[z] = submitFormObj[documentObject.docid][z].value;
......
50 51
		}
51 52
	}
52 53
	else {
53
		if (submitFormObj.docids.checked) {
54
		//alert("submitFormObj.docid=" + submitFormObj.docid);
55
		if (submitFormObj.docid.checked) {
54 56
			var documentObject = new Object();
55
			documentObject.docid = submitFormObj.docids.value;
57
			documentObject.docid = submitFormObj.docid.value;
56 58
			
57 59
			for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
58 60
				questionIds[z] = submitFormObj[documentObject.docid][z].value;
......
171 173
	for (var i=0; i < docObjs.length; i++) {
172 174

  
173 175
		var docId = docObjs[i].docid;
174
		alert("docId=" + docId);
176
		//alert("docId=" + docId);
175 177
		
176 178
		//get the question ids for this question
177 179
		var questionIds = docObjs[i].questionIds;
178 180
	
179
		alert("questionIds=" + questionIds);
181
		//alert("questionIds=" + questionIds);
180 182
		
181 183
		//assemble the assessment metadata
182 184
		var metadataAttributeSelection = "";
......
267 269
		 "</union>"	
268 270
		 + "</dataquery>";
269 271
	
270
	alert(tempQuery);
272
	//alert(tempQuery);
271 273
             
272 274
    return tempQuery;
273 275
}
......
424 426
	return query;	
425 427
}
426 428

  
427
function callAjax(metacatURL, myQuery, qfmt) {
429
function callAjax(metacatURL, myQuery, qfmt, divId) {
428 430
														
429 431
	//alert("calling ajax: " + metacatURL);
430 432
	//alert("myQuery: " + myQuery);
431 433
	
432 434
	//var myRequest = new Ajax.Request(
433 435
	var myUpdate = new Ajax.Updater(
434
		'ajaxResults',
436
		divId,
435 437
		metacatURL,
436 438
		{	method: 'post',
437 439
			parameters: { action: 'squery', qformat: qfmt, query: myQuery},
lib/style/skins/first/index.jsp
80 80
			
81 81
			//alert("queryString=" + queryString);
82 82
			
83
			callAjax(metacatURL, queryString, "first-assessment");			
83
			callAjax(metacatURL, queryString, "first-assessment", "ajaxSearchResults");			
84 84
		}
85 85
   </script>
86 86
</head>
......
181 181
	</tr>
182 182
	<tr>
183 183
		<td valign="top" colspan="2">	
184
			<div id="ajaxResults">Search results...</div>
184
			<div id="ajaxSearchResults">Search results...</div>
185 185
		</td>
186 186
	</tr>
187 187
</table>

Also available in: Unified diff