...

View Full Version : Open report format in new window from drop down box



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>&nbsp
<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>

rangana
07-30-2008, 04:16 AM
You're not showing us the function that is being called when "Finish Button" is ticked.

Please show us the remaining code. Meanwhile, one thing I'm certain is that you should add the highlighted:


<input type="hidden" name="run.outputFormat" value="HTMLFragment" id="run.outputFormat">


Your script is looking for an id which (from the snippet you've shown) is missing.

jlzilka
06-11-2009, 06:02 PM
Hi, I'm new to the Forum and am looking for the same information as this post. I used the code below in an HTML item on my prompt page and the drop down list of formats appears but when I select an alternate format and run the report it does not run in the selected format. You mentioned wanting to see the function that is being called when the Finish button is ticked, is this what I am missing? Should that code be in the same HTML object or do I need a second HTML object after the finish button?

Thanks for your help!


<input type="hidden" name="run.outputFormat" value="HTMLFragment" id ="run.outputFormat">
<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;
}
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>
<SELECT NAME="changeOutput" onchange="chgOutput(this)">
<option value="HTML" >HTML</option>
<option value="PDF">PDF</option>
<option value="singleXLS">Excel 2000 Single Sheet</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>

rangana
06-11-2009, 06:09 PM
Hi jlzilka,

Welcome on board :)

The code seemed fine (for me)

Anyway, I'm confused on what you meant by selecting an alternate format and run the report.

What do you mean by that? What's the alternate format and how do you run the report? On the first place, which is the report?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum