phanicrn
07-29-2008, 07:51 PM
I have javascript which gives us different ouput formats for a report in drop down box, and i select format as pdf and click finish button report ouput should open in new window. now it's opening in same window. basicaly i am not java script developer , i dont know where to tweak it.
<input type="hidden" name="run.outputFormat" value="HTMLFragment">
<script type="text/javascript" >
function chgOutput(selFormat)
{
//User has selected new value...retrieve value and set hidden input
document.getElementById("run.outputFormat").value = selFormat.options[selFormat.selectedIndex].value;
//alert("This form is " + f.name + ".");
}
function dfltOutput()
{
//set the format dropdown to the default correctly
si="HTML"
selFormat = document.getElementById("changeOutput");
txt = document.getElementById("run.outputFormat").value;
for(i=0; i<selFormat.length; i++)
{
if(selFormat.options[i].value == txt)
{si = i;}
}
selFormat.selectedIndex = si;
}
</script>
<B><FONT STYLE="width: 50px; font-family : Arial; font-size : 8pt">Report Format:</FONT></B> 
<SELECT NAME="changeOutput" onchange="chgOutput(this)">
<option value="HTML">HTML</option>
<option value="PDF">PDF</option>
<option value="XLWA">Excel 2002</option>
<option value="XLS">Excel 2000</option>
<option value="CSV">Delimited text (CSV)</option>
<option value="XML">XML</option>
</SELECT>
<input type="hidden" name="run.outputFormat" value="HTMLFragment">
<script type="text/javascript" >
function chgOutput(selFormat)
{
//User has selected new value...retrieve value and set hidden input
document.getElementById("run.outputFormat").value = selFormat.options[selFormat.selectedIndex].value;
//alert("This form is " + f.name + ".");
}
function dfltOutput()
{
//set the format dropdown to the default correctly
si="HTML"
selFormat = document.getElementById("changeOutput");
txt = document.getElementById("run.outputFormat").value;
for(i=0; i<selFormat.length; i++)
{
if(selFormat.options[i].value == txt)
{si = i;}
}
selFormat.selectedIndex = si;
}
</script>
<B><FONT STYLE="width: 50px; font-family : Arial; font-size : 8pt">Report Format:</FONT></B> 
<SELECT NAME="changeOutput" onchange="chgOutput(this)">
<option value="HTML">HTML</option>
<option value="PDF">PDF</option>
<option value="XLWA">Excel 2002</option>
<option value="XLS">Excel 2000</option>
<option value="CSV">Delimited text (CSV)</option>
<option value="XML">XML</option>
</SELECT>