Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Those who interested in AJAX and WebFOCUS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SHARING] Those who interested in AJAX and WebFOCUS
 Login/Join
 
Guru
posted
AJAX mainly used for updating particular DOM without reloading the page.

I've 2 combobox and 2 text boxes in HTML, would like to update text boxes & combobox2 if combobox1 selection changes from ALL.

Associate ACombo1.fex to combo1 with ALL option

-* File ACombo1.fex
-DEFAULT &CNT='_FOC_NULL';
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ '&CNT'
ON TABLE PCHOLD FORMAT XML
END  


On combo2, have static COUNTRY values.

In your HTML,
//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {
	 document.getElementById("combobox2").value = "0";
    document.getElementById("edit1").value = "";
    document.getElementById("edit2").value = "";
if (document.getElementById("combobox1").value != "_FOC_NULL") {
	 alert("Values changed");
  callServer();
}
}
//End function combobox1_onchange

var xmlHttp = false;


if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function callServer() {
 var val = document.getElementById("combobox1").value;
 var url = "/ibi_apps/WFServlet" + "?" + "IBIF_ex=rifaz/ACombo1.fex" + "&" + "CNT=" + val;
 xmlHttp.open("GET", url, true);
 xmlHttp.onreadystatechange = domupdate;
 xmlHttp.send(null);
}

function domupdate() {
 if (xmlHttp.readyState == 4) {
     if (xmlHttp.status == 200 ) {
    var responseXML = xmlHttp.responseXML;
alert("response OK");
         var trs = responseXML.getElementsByTagName("tr");
         var tds = trs[0].getElementsByTagName("td");
         var cb1 = tds[0].firstChild.nodeValue;
          if (cb1 == 0){
             document.getElementById("combobox2").options[0].selected = true;
             }
          else {
          document.getElementById("combobox2").value = tds[0].firstChild.nodeValue;
             }
    document.getElementById("edit1").value = tds[0].firstChild.nodeValue.trim();
    document.getElementById("edit2").value = tds[0].firstChild.nodeValue.trim();

}
}
}  

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


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Virtuoso
posted Hide Post
Thanks for sharing Rifaz.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
I have to admit that I am not impressed with IBI's implementation of FORMAT XML, as its HTML in an XML wrapper.


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!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
In the end - it's still just "parsing". But - I must admit - it took a bit more time to figure out what they were doing and parse it out because it's not exactly what I was expecting. So much for XPATHs :-)


webFOCUS 8207.15
WindowsServer 2019
 
Posts: 120 | Location: Minnesota | Registered: August 26, 2013Report This Post
Platinum Member
posted Hide Post
It might be a dumb or valid question.

Can this program will work on MRE? I have my HTML in MRE and the fex in server but it is not working. When I run the fex directly in the browser, it works.

By the way, I am running the HTML in developer studio, is that be a issue?


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
Master
posted Hide Post
I happen to do a lot outside of WebFOCUS with WebFOCUS wrapped around it. I just find it easier. I'm currently doing Google Maps API, even though it can be done in WebFOCUS there are limits, but if I do it within HTML (fex), then I have only Google API limits and I can still use my data being called through WebFOCUS to drive the map.

So basically, because of customer requirements that expand way outside of WebFOCUS, but they still require the use of WebFOCUS, I wrap it in HTML like his example above.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Guru
posted Hide Post
WFDevConsultant,

are you getting the "response OK" alert for responseXML variable?


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Platinum Member
posted Hide Post
I am getting error when try to display the responseXML.


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
Guru
posted Hide Post
I sent a private message to you.
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Master
posted Hide Post
Not to long ago I was using readyState and found out that IE/FireFox/Chrome tend to use it differently. If your project needs to be cross browser compliant, I would suggest checking the big 3 to make sure that you get the results that your expecting.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Gold member
posted Hide Post
Hi Rifaz,

I'm trying to use your AJAX to refresh some parameters/filters in a HTML Page. I have 9 basic bar charts and 9 different parameters tied to those bar charts. I have some chaining going on with the parameters, but I want to tie all the parameters together (they are all in one hold file) and have them updated. For example) I have region, country, business unit, and sales rep all chained together, but if the user selects the lowest level, sales rep, I want the business unit, country, and region updated. That's just one process flow. Like I mentioned before I need all the parameters updated once the user selects one parameter. Can you help me out with this?

Thank you


WebFOCUS 8
Windows, All Outputs
 
Posts: 88 | Registered: December 06, 2016Report This Post
Guru
posted Hide Post
Apologies for being too late to reply. I don't get a time to visit focal point now a days as I'm into infrastructure admin.
Have you looked into "Magically filter Reports in BI Portal" doc? I think that may solve your problem.


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Those who interested in AJAX and WebFOCUS

Copyright © 1996-2020 Information Builders