Focal Point
[SOLVED] Run reports on change of value in dropdowns

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

February 28, 2011, 03:44 PM
Enigma006
[SOLVED] Run reports on change of value in dropdowns
Hai all

This may be more of a html question.

I have a 3 drop downs chained together and there are multiple reports than run and should display.
As of they run from a Submit button.
Is there a way to remove the button and all reports should run when value from drop down is selected. It could be value from any drop down. but with each change of value in each drop down, reports should run. All of them will be single selects though. As of now I am trying by using onclick and onchange events.

Any suggestions on this?

Thanks

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


8.1.05
HTML,PDF,EXL2K, Active, All
February 28, 2011, 04:11 PM
Waz
From an HTML/javascript perspective, adding an onchange event should do it. you may have to be careful with this as I think some changes don't get picked up, say useing rhe keyboard, in some browsers.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 28, 2011, 04:13 PM
Enigma006
Thanks Waz. I am trying using those functions but I am not sure of the code inside them. I am trying something but doesn;'t seem to go right.


8.1.05
HTML,PDF,EXL2K, Active, All
March 01, 2011, 10:23 AM
Wep5622
I think you will need buttons to create the 'Hyperlinks' to the fexes to excute.

You can hide those buttons (style display: none) and call their respective OnExecute() handlers from your OnChange events - Do pass in the correct control though, namely that of the button, not that of the dropdown list!


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 01, 2011, 03:11 PM
MathematicalRob

 onchange="document.getElementById('form2Submit').click();"



Perhaps?


WebFocus 8201m on Windows; App Studio 8201; Procedures: WebFocus with SQL; HTML Parameter Pages & Dashboard; Output: Excel, HTML, & PDF.
March 01, 2011, 03:20 PM
Enigma006
I tried what Wep5622 suggested and it seems to be working good in a way.
thanks..!!


8.1.05
HTML,PDF,EXL2K, Active, All
March 01, 2011, 04:28 PM
Waz
You don't need buttons, just the onchange event.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
<script language="JavaScript">
<!--
	function processChange() {
		alert('Change\n\nSubmitting...') ;
		document.forms['testform'].submit();
	}
//-->
</script>
 </head>

 <body>
 <form method=post action="post" name="testform">
  <select name="test" onchange="processChange() ;">
	<option value="1" selected>1
	<option value="2">2
  </select>
 </form>
 </body>
</html>


Firefox and Chrome do not pick up the change if the arrow keys are used, some extra javascript coding and events will be need to capture that.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 02, 2011, 03:49 AM
Wep5622
Well, there are some subtleties to this issue specific to WebFOCUS, so I provided an approach for which I was reasonably sure it would work Wink

Normally you would indeed be able to just submit the form instead of using a button, but the situation seems to be a bit more complicated in WebFOCUS. For a button on a launch page (using the HTML Composer) you create a Hyperlink for which the composer generates XML that describes the hyperlink's properties, among which are the fexes that need to be called when the button is used.
I don't think you get those particular lines of XML for any other type of form-element. Hence, if you were to just create an onchange event-handler you would be missing those lines of XML. I doubt the form would work as intended without them.

There's probably a way to copy that behaviour though. For example, you could remove the button from the generated HTML page source after setting up the hyperlink's properties. It's quite possible though that WebFOCUS notices the orphaned XML elements that belonged to the button and removes them. I honestly don't know if it can do that or if a future version might start doing that... Besides, you wouldn't be able to edit the hyperlink properties any more, as that functionality is a property of the button.


As for Firefox (and probably Chrome) not responding to onchange-events when keyboard navigation is used - that's not true.

They fire the event at a different moment than IE (and old Netscape) do, namely when you change focus away from the element in question - which is usually when you tab to the next element. It does work, it just works differently. Knowing the folks behind it a bit - there's probably a rather good reason.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 02, 2011, 12:17 PM
Enigma006
Suggestion by Waz worked great as well. Thanks all. Can I use the same thing and use both onchange and onclick events?


8.1.05
HTML,PDF,EXL2K, Active, All