Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open report format in new window from drop down box

    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>

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    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:
    Code:
    <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.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    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?
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •