[SOLVED] using reset button to clear html report and dropdowns
I have an html report with four dropdowns and an iframe with the report results. I'm trying to change the reset button to clear all four dropdowns and the iframe with one click. I changed the reset button type to button and added the onclick event handler. Here is the code for it (which is inside SCRIPT tags with some other functions):
//Begin function form1Reset_onclick
function form1Reset_onclick(ctrl) {
document.getElementById('combobox1').contentWindow.Reset();
document.getElementById('combobox2').contentWindow.Reset();
document.getElementById('combobox3').contentWindow.Reset();
document.getElementById('combobox4').contentWindow.Reset();
document.getElementById('report1').contentWindow.Reset();
}
//End function form1Reset_onclick
</SCRIPT>
If I leave the type as reset, then all four dropdowns reset, but when I use the above code, nothing gets reset. Any ideas?
Thanks! TheresaThis message has been edited. Last edited by: Theresa,
This should work for all form objects. An IFRAME is not form a object, but a container for HTML. You need to change the location of the iframe to an empty html page.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 04, 2010, 03:50 PM
<JG>
src='#'
October 05, 2010, 10:43 AM
Enigma006
Why not use the Reset button given by HTML composer. It does the job without writing any code manually..
Thanks
8.1.05 HTML,PDF,EXL2K, Active, All
October 05, 2010, 12:46 PM
Doug
I second / agree with Enigma006's sugesstion.
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
October 06, 2010, 12:46 PM
Theresa
quote:
Originally posted by Enigma006: Why not use the Reset button given by HTML composer. It does the job without writing any code manually..
Thanks
I tried that. That was the reset button I was trying to modify. It cleared all of the dropdowns, but not the report output which is in an iframe. I need all of them reset with the click of one button.
My VPN was fixed today. I tried your suggestion, but it didn't help. When I click on the Reset button, I get a popup that says that IE needs to resend the information and to click Retry to continue. When I click on Retry, it comes back with a blank page with just the "No query information to decode" message.
That did the trick for me. I'm using IE8, which may be why setting src does not work (guessing here).
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 02, 2010, 04:14 PM
Theresa
I tried the suggestions posted. I can either get all of the dropdowns to reset, or I can get the report results to be cleared. I cannot get one button to clear/reset everything with one click.
Here's what I currently have in my button onclick event handler:
Is the frame part of the form? If it is then it should be reset by the reset action, if not then you need to either ensure that it is wihn the frame or reset it separately.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
November 03, 2010, 06:10 AM
GamP
I tried to simulate your problem. SO I created an html file with four unchained dropdowns to populate &vars for use with selecting records out of the car database. One for country, one for car, one for model and one for bodytype. I included a Run button and a Reset button. The run button runs a very simple report and the reset button was just that, no actions specified. Last the iframe was added to hold the result of the simple report. Running it showed that the reset button reset all dropdowns, but not the iframe. SO added the onclick event for the reset button to clear the iframe. That worked, but now the dropdowns were not reset any more. So what I did was add the reset of the dropdowns myself. Using your code with the 'contentWindow.Reset' mnethod presented a javascript error message. So I tried to simply set the selected index of the combobox to 0. That had the desired effext. The code in the onclick event nnow is:
This works sweet, except how would I get it to work with chained drop downs? When reset it retains the previous load. I have a last name combobox and a first name combobox. Say I pick adams for the last name, this will limit the choices now for the first name down to only three. This is what it is suppose to do. Then I hit reset button, select a different last name and I still get the previous first names........any ideas?? Thanks I'm also having trouble setting the focus on the last name combobox.
WebFOCUS Server 8.1.05 Windows 2008 Server WebFOCUS AppStudio 8.1.05 Windows 7 Professional IE 11 and Chrome Version 43.0.2357.124 m. Mostly HTML, PDF, Excel, and AHTML
January 17, 2013, 10:33 AM
Doug
Thanks again all you contributors... I just found some of the "document.getElementById" code that I needed, right here on FocalPoint.