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     [CLOSED] HTML, javascript and .fex

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] HTML, javascript and .fex
 Login/Join
 
Member
posted
Does anyone know of a way to read a field from a .fex (or database) using javascript and then populate a text box in an HTML form with the data from that field?
Example: I have an HTML form where the user can select to view, add, modify, delete records. What I'd like to happen, when they select modify, is for the text boxes to update with the data from the record they have selected to modify. They would select the record by either entering an id number or selecting from a drop down. I think I understand how to set the value using javascript, just not sure if there is a way to read the values from the .fex (or database) in order to work with them in javascript.
Thanks in advance for any assistance anyone can offer.

I am on webfocus version 7702.

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


WebFOCUS 8008
Windows, All Outputs
 
Posts: 26 | Registered: October 11, 2010Report This Post
<FreSte>
posted
I would recommend using jQuery.
Maybe you can get some inspiration from this post.

-Fred-
 
Report This Post
Expert
posted Hide Post
There are many ways to do this.

A method I use is to use IBI's xmlhttp aupport script library.

Your fex just PCHOLDs the data format XML.

The call is made through this object, and the answerset is available to javascript.


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
Expert
posted Hide Post
Here is an example I just knocked up...

HTML part: (fp_xmlhttp.html)
You will have to change the IBIAPP_app to your location.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title> My Report </title>
  <meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
  <SCRIPT id=IBI_OptionsScript type=text/javascript>
    var ibiOptions = new Array("ibihttpxml") ;
  </script>
  <script type="text/javascript" language="Javascript" src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>
  <script type="text/javascript">
   <!--
    function funGetData() {
     var ibihttp = new ibihttpxml("/ibi_apps/WFServlet",null) ;
     ibihttp.openFromForm(document.forms.My_Form) ;
     alert(ibihttp.xmlhttp.responseText) ;
     var CtySales = ibihttp.selectSingleNode("//fxf/report/table/tr/td");
     document.getElementById("SALES").value = ibihttp.getNodeText(CtySales) ;
    }
   //-->
  </script>
 </head>

 <body onload="">
  <form method="post" name="My_Form">
   <table>
    <tr>
     <td>Country</td><td><input type=text name="COUNTRY" value="ENGLAND"></td>
    </tr>
    <tr>
     <td>Sales</td><td><input type=text name="SALES" id="SALES"></td>
    </tr>
    <tr>
     <td><input type=button value="Get Sales" onclick="funGetData()"></td>
     <td></td>
    </tr>
   </table>
   <input type=hidden name="IBIF_ex" value="fp_xmlhttp">
   <input type=hidden name="IBIAPP_app" value="focalpoint">
 </form>
 </body>
</html>


Fex part: (fp_xmlhttp.fex)
TABLE FILE CAR
SUM SALES
WHERE COUNTRY EQ '&COUNTRY'
ON TABLE PCHOLD FORMAT XML
END


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
Member
posted Hide Post
Thank you both for the suggestions - I will review this information today and let you know how it turns out.


WebFOCUS 8008
Windows, All Outputs
 
Posts: 26 | Registered: October 11, 2010Report This Post
Member
posted Hide Post
Hi Waz,

I am giving your method a try. I think I am pretty close, but cannot seem to get the textbox I am using to populate. I was able to successfully get your demo to work, and then convert it to pull the data from my data sources and change the variable and field names. The issue comes in when I try to figure out how to implement this into a form that I have already developed in HTML composer. Even if I open the demo in HTML composer (vs text editor), there is a lot of additional code that is inserted, making it very difficult for me to keep things straight. I know this is a difficult question to answer without seeing my code, but are there some tips you can share that might help me troubleshoot what is missing?

One error that I am seeing is "no valid cgi request to process." "Webfocus was called with an invalid request."

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


WebFOCUS 8008
Windows, All Outputs
 
Posts: 26 | Registered: October 11, 2010Report This Post
Expert
posted Hide Post
If you like, send me a PM with your code, and I'll take a look.

I suspect much of the infrastructure will already be there, so adding the code may be easy.

As with another post I saw today, the HTML composer likes to rewrite the code, so adding inside composer, I guess, may be the best way, if not add it manually and don't go back to composter.


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
Member
posted Hide Post
Hi Waz - I sent you a PM regarding this, let me know if you didn't receive and I will try again.
Thanks.


WebFOCUS 8008
Windows, All Outputs
 
Posts: 26 | Registered: October 11, 2010Report This Post
Expert
posted Hide Post
I got it, but am very busy at the moment.

You've added the script OK, but getting the ibihttpxml added and stay there if you reopen in composter will be more difficult.


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
Virtuoso
posted Hide Post
quote:
composter
Waz, I love it. I'll never be able to say the real name again.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
Me too! What a great name!!!


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I think the first time was a typo.

Winky


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
Master
posted Hide Post
Waz,

Many thanks for the clear simple example of using IBI's xmlhttp support script library. (Definitely very helpful to an xmlhttp newbie like me.)

I was able to implement your example A-OK in my environment (MRE).

Dave

This message has been edited. Last edited by: David Briars,
 
Posts: 822 | Registered: April 23, 2003Report This Post
Expert
posted Hide Post
quote:
Many thanks for the clear simple example of using IBI's xmlhttp support script library.

How dare this be a secret? Winky


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Its only a secret if you don't go looking for it......


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
Member
posted Hide Post
Waz - I was able to get this to work as well. I just had some extra /form tags in my code and needed to connect the control name to the .fex I was using.

Thanks again for the help.

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


WebFOCUS 8008
Windows, All Outputs
 
Posts: 26 | Registered: October 11, 2010Report 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     [CLOSED] HTML, javascript and .fex

Copyright © 1996-2020 Information Builders