Bug 183307 JS error with cascading group in birt:paramDef tag.[0603]
Description: JS error with cascading group in birt:paramDef tag. Build number:2.2.0.v200704190630 Steps to reproduce: 1. New a report with cascading group from sample table OFFICES(COUNTRY, OFFICECODE). 2. New a jsp file with content: <birt:parameterPage id="0" name="custom param page" reportDesign="report.rptdesign" isCustom="true" pattern="frameset"> <birt:paramDef id="9" name="country" value="USA"/> <input type="submit" name="OK" value="submit"/> </birt:parameterPage> 3. Preview the jsp file. Expected result: Display Listbox/combobox with value "USA" as default. Actual result: JS error A runtime error is occurred Error log:N/A
viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/taglib/ParamDefTag.java
if ( index == group.getParameterCount( ) - 1 )
			return;
		String casObj = "cas" + encParamId; 
		String namesObj = "names_" + encParamId; 
		writer.write( "\n<script language=\"JavaScript\">\n" ); 
		writer
				.write( "var " + namesObj + " = new Array( " + ( index + 2 ) + " );\n" ); 
		for ( int i = 0; i < index + 2; i++ )
		{
			ParameterDefinition param = (ParameterDefinition) group
					.getParameters( ).get( i );
			writer.write( namesObj + "[" + i + "] = \"" 
					+ ParameterAccessor.htmlEncode( param.getName( ) )
					+ "\";\n" ); 
		}
		writer
				.write( "var " + casObj + " = new CascadingParameter( \"" + this.viewer.getId( ) + "\", param, " + namesObj + ", " + this.groupObjName + " );\n" ); 
		writer
				.write( "var selectCtl = document.getElementById(\"" + encParamId + "\");\n" ); 
		writer.write( "selectCtl.onchange = function( ) { \n" ); 
		writer.write( "var selectCtl = document.getElementById(\"" + encParamId 
				+ "\");\n" ); 
		writer.write( "handleParam" + encParamId 
				+ "( selectCtl.options[selectCtl.selectedIndex] );\n" ); 
		writer.write( "progressBar.setHandler(" + casObj + ");\n" ); 
		writer.write( casObj + ".process( ); };\n" ); 
		writer
				.write( "var inputCtl = document.getElementById(\"" + inputTextId + "\");\n" ); 
		writer.write( "if( inputCtl )\n" );