Focal Point
[SOLVED] using reset button to clear html report and dropdowns

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/917104835

October 01, 2010, 04:25 PM
Theresa
[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!
Theresa

This message has been edited. Last edited by: Theresa,


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
October 01, 2010, 04:56 PM
Francis Mariani
document.getElementById(formid).reset();


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.


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
October 13, 2010, 01:26 PM
Theresa
quote:
Originally posted by JG:
src='#'


JG,

I don't understand. What object is this the source for? Where is this supposed to go?

Theresa


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
October 13, 2010, 01:49 PM
Sayed
Try this.

On you button property add
  
onclick=window.location.reload()




Your html code should look something like this

  
<INPUT language=java_script class=pagetitle id=button2 style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; Z-INDEX: 145; LEFT: 920px; WIDTH: 80px; FONT-FAMILY: Arial; POSITION: absolute; TOP: 211px; HEIGHT: 25px" onclick=window.location.reload() tabIndex=146 type=button value=Reset name=button2 requests_list="12" persistentuniqueid="compUid_68" autoExecute="True">



Thanks,
Sayed


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
October 26, 2010, 03:04 PM
Theresa
I haven't been able to test this yet. My secure connection to the WebFocus server has been down since the holiday (Oct. 11).

Theresa


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
October 27, 2010, 01:57 PM
Theresa
quote:
Originally posted by Sayed:
Try this.

On you button property add
  
onclick=window.location.reload()




Your html code should look something like this

  
<INPUT language=java_script class=pagetitle id=button2 style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; Z-INDEX: 145; LEFT: 920px; WIDTH: 80px; FONT-FAMILY: Arial; POSITION: absolute; TOP: 211px; HEIGHT: 25px" onclick=window.location.reload() tabIndex=146 type=button value=Reset name=button2 requests_list="12" persistentuniqueid="compUid_68" autoExecute="True">



Thanks,
Sayed


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.


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
October 27, 2010, 03:05 PM
Tony A
Combine what Francis and JG suggested ....
function form1Reset_onclick(ctrl) {
document.getElementById('report1').src = "";
document.form.reset();
}

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 
October 28, 2010, 03:41 AM
GamP
I had to do something similar. Setting src for a frame did not work for me either. What did work was coding it like this:
window.top.frames.report1.location.href = 'about:blank';
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:
  document.getElementById('report1').src = "";
document.form1.Reset();


Theresa


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
November 02, 2010, 05:33 PM
Tony A
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:
document.getElementById('combobox1').selectedIndex = 0;
document.getElementById('combobox2').selectedIndex = 0;
document.getElementById('combobox3').selectedIndex = 0;
document.getElementById('combobox4').selectedIndex = 0;
window.top.frames.iframe1.location.href = 'about:blank';
and this clears all elements on my screen.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 05, 2010, 01:24 PM
Theresa
quote:
Originally posted by GamP:
The code in the onclick event nnow is:
document.getElementById('combobox1').selectedIndex = 0;
document.getElementById('combobox2').selectedIndex = 0;
document.getElementById('combobox3').selectedIndex = 0;
document.getElementById('combobox4').selectedIndex = 0;
window.top.frames.iframe1.location.href = 'about:blank';
and this clears all elements on my screen.

Hope this helps ...


That did it! Thanks, GamP!! This code worked for me.

Theresa


PMF: 5.2.3 HF 4
Server: WF 7.6.11/DB2
Desktop: WF 7.6.11/SQL Server/XP
output: HTML
November 16, 2010, 12:23 PM
MAdams1
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
Cool Thanks again all you contributors...
I just found some of the "document.getElementById" code that I needed, right here on FocalPoint.