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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Adding records from an html form to a focus table

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Adding records from an html form to a focus table
 Login/Join
 
Member
posted
Anyone…I need help with adding a record from an html form to a focus file.

I was an MS Access Database person and now want to convert everything over to WF. I have been creating all my reports and updating files via the text editor and would now like to get away from that.

My first task is to create a web based project tracking system. I’ve read just about every post, on html forms and I have a very good understanding of the MODIFY FILE capabilities within MRE. And I see that there are a lot of preferred methods of capturing data (JavaScript, CGI, etc., at which I have little knowledge). What I don’t seem to be able to find anywhere is how to capture and hold the values from an html form.

I have created a focus table for the projects and a Fex that returns the default record. I would like the user to then enter new values in the html form, and then click the submit button to save the new project. If the project name is not in the table, I then want to add the contents of the form into the table. Can anyone assist?

I know this is probably a simple thing, but I’m unable to locate any documentation with examples.

Thanks!

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


WebFOCUS 8.1.05, UNIX, Oracle, Excel, PDF, HTML
 
Posts: 9 | Location: dgriffin@att.com | Registered: January 05, 2007Report This Post
Virtuoso
posted Hide Post
Deric,

Whatever you put on an html form will be transfered back to your fex as &-variables.
The form will at least have to have something like:
   <form method="GET" name="form" action="/ibi_apps/WFServlet">
    <input type="hidden" name="IBIAPP_app" value="myapp myotherapp mythirdapp">
    <input type="hidden" name="IBIF_ex" value="myfex">

--- your HTML variables --- for instance

      <select NAME="WFFMT" style="width:150;">
       <option value="HTML">HTML</option>
       <option value="PDF">PDF</option>
       <option value="EXL2K">Excel</option>
     </select>

---

    <input type="submit" value="Run">
  

And then in 'myfex' you would have at least the &WFFMT variable.
You could try to see how this works by putting on the first lines of your fex:
-? &
-EXIT
This will show you all & variables available to you at that point with the value they have.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Deric,

A small example. Say that your HTML form captures a value for COUNTRY (of the CAR file) in an &variable named &COUNTRY. And say that you want to add this value to the CAR file. Your fex would like like this:
  
MODIFY FILE CAR
FREEFORM COUNTRY
MATCH COUNTRY
ON NOMATCH INCLUDE
ON MATCH REJECT
DATA
COUNTRY='&COUNTRY', $
END

Good luck.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
Thanks for the help. Making progress! I'm attempting to complete this task based on the help that you folks have supplied.

I'm not sure if I will have any problems with the dates that need to be passed from the form, but will let you know where I'm later today.

Thanks again!


WebFOCUS 8.1.05, UNIX, Oracle, Excel, PDF, HTML
 
Posts: 9 | Location: dgriffin@att.com | Registered: January 05, 2007Report This Post
Expert
posted Hide Post
here is an example of a MODIFY using a whole bunch of &vars
1) here's the master
FILENAME=efinusage, SUFFIX=FOC    , $
SEGMENT=SEG01, SEGTYPE=S1, $
FIELDNAME=DATE, ALIAS=E01, USAGE=A8,      $
SEGMENT=SEG02, SEGTYPE=S1, PARENT=SEG01, $
FIELDNAME=TIME, ALIAS=E02, USAGE=A8,     $
SEGMENT=SEG03, SEGTYPE=S1, PARENT=SEG02,  $
FIELDNAME = USERID, ALIAS = E03, USAGE = A8, $
SEGMENT=SEG04, SEGTYPE=S1, PARENT=SEG03, $
FIELDNAME=FEXNAME, ALIAS=E04, USAGE=A20,   $
FIELDNAME=DOMAIN,ALIAS = E05, USAGE=A8,$
FIELDNAME=CORP, ALIAS=E06, USAGE=A5,   $
SEGMENT=SEG05, SEGTYPE=S1, PARENT=SEG04, $
FIELDNAME=RANDOM, ALIAS=E07, USAGE=A8,    $


and there's the MODIFY bit

MODIFY FILE efinusage
FIXFORM DATE/A8 X1 TIME/A8 X1 USERID/A8 X1 FEXNAME/A20 X1 DOMAIN/A8 X1 CORP/A5 X1 RANDOM/A8
MATCH DATE
 ON MATCH CONTINUE
 ON NOMATCH INCLUDE DATE
MATCH TIME
 ON MATCH CONTINUE
 ON NOMATCH INCLUDE TIME
MATCH USERID
 ON MATCH CONTINUE
 ON NOMATCH INCLUDE USERID
 MATCH FEXNAME
 ON MATCH CONTINUE
 ON NOMATCH INCLUDE FEXNAME DOMAIN CORP
MATCH RANDOM
 ON MATCH REJECT
 ON NOMATCH INCLUDE RANDOM
 DATA
&YYMD &TOD &ftuser &ftname &ftdomain &ftcorp &ftrandom
 END



one wee bit of advice, when using &vars, make absolutely sure that if you have one that SHOULD be /A8, say, that is really IS /A8
If you have some input from your htmlform
where the value could be /A4 and you need it to be /A8, force it!
-DEFAULT &MYVAR = 'FRED';
-SET &MYVAR2 = &MYVAR | ' ';
-SET &MYVAR2 = EDIT( &MYVAR , '99999999');

In the MODIFY snippet, line 2, the X1 indicate a blank between each variable name in the DATA
line.
and be careful that the 1st variablename in your DATA line is fully left adjusted.

and,,,i've found a limit to the number of elements i can take from 1 html screen in 1 fell swoop...something like 30...for whatever that's worth to you. may have had something to do with URL max length, may have been browser dependent..dunno anymore.... just a word to the wise, if you encounter a limit, work around it.

Great project you've got. applause to your efforts.
s




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Ok…the form works fine, with one exception. After the modify fex is complete, I’m getting the “No HTML Output!” page, and was wondering how to avoid that or how to send the user to another html page.

Thanks again for all your help!


WebFOCUS 8.1.05, UNIX, Oracle, Excel, PDF, HTML
 
Posts: 9 | Location: dgriffin@att.com | Registered: January 05, 2007Report This Post
Guru
posted Hide Post
After your FEX you can just put some HTML like
MODIFY BLAH
END
-HTMLFORM BEGIN



YOUR DATA IS UPDATED !



-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Guru
posted Hide Post
I meant to type
-HTMLFORM BEGIN
<HTML><HEAD></HEAD>
<BODY>
YOUR DATA IS UPDATED !!
</BODY>
</HTML>
-HTMLFORM END  


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Expert
posted Hide Post
well,gosh, there are any number of ways.
simplest might be to execute another fex at the conclusion of your modify bit..
either via
EX fexname {passing any parms you might need}
or
-MRNOEDIT -INCLUDE domainname/app/fexname
or
-HTMLFORM BEGIN
..some html here, or some report or page you've already made, like
!IBI.FIL.mytab;
-HTMLFORM END




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thanks everyone!

I have setup a main form that allows the users to enter and track the status on their group’s projects. They are very satisfied with the outcome…I couldn’t have done it without all your help.


WebFOCUS 8.1.05, UNIX, Oracle, Excel, PDF, HTML
 
Posts: 9 | Location: dgriffin@att.com | Registered: January 05, 2007Report This Post
Expert
posted Hide Post
Deric,

I know that you have marked this as closed but I would like to add that a more streamline method would be to use AJAX.

Here's an example of a simple routine that allows you to add new countries to the CAR database. I reuse the IB javascript routines that issue the server request in the AJAX method - why reinvent the wheel?

-DEFAULT &TITLE   = 'Ajax Example'
-DEFAULT &Country = 'ENGLAND'
DEFINE FILE CAR
  SELECTED/A12   = IF COUNTRY EQ '&Country' THEN ' selected' ELSE '';
  CTRY_OPTS/A200 = '  <option  value="'||COUNTRY||'"'|SELECTED|'>'||COUNTRY||'</option>';
END

TABLE FILE CAR
PRINT CTRY_OPTS
   BY COUNTRY NOPRINT
ON TABLE SAVE AS CTRYOPTS
END
-RUN
SET ALL = ON
TABLE FILE CAR
SUM RCOST
    DCOST
 BY COUNTRY
 BY CAR
 BY MODEL
WHERE COUNTRY EQ '&Country'
ON TABLE HOLD AS CARDETS FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF, SIZE=8, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<title>!IBI.AMP.TITLE;</title>
<!-- The only IB scripts required are ibirls but this requires ibigbl so we include that here -->
<!-- ibirls2 is not used as it removes the onchange event and screws the processing -->
<script id=IBI_OptionsScript type=text/javascript>
var ibirls = "ibirls";
var ibiOptions = new Array(ibirls);
</script>
<script id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript></script>
<script language="JavaScript">
function refresh_form() {
  document.form.reset();
// You could add additional processing here to be actioned on form reset
}
function run_update() {
  generate_random();
  document.form.submit();
// You could add additional processing here to be actioned on form reset
}
function generate_random() {
   var Random_No = Math.floor(Math.random()*100000);
   Rand = document.getElementById("IBIMR_random");
   Rand.value = Random_No;
}
function add_Country() {
  Country = document.getElementById("New_Ctry").value;
  add_Country = confirm('Are you sure that you want to add '+Country+'?');
  if (add_Country != true) {
    return;
  } else {
    var request = '/ibi_apps/WFServlet?IBIC_server=EDASERVE&|IBIAPP_app=reports&|IBIF_adhocfex=MODIFY FILE CAR%0D%0AFREEFORM COUNTRY%0D%0AMATCH COUNTRY%0D%0AON MATCH REJECT%0D%0AON NOMATCH INCLUDE%0D%0ADATA%0D%0A'+Country+',$%0D%0AEND&|Rand='+Math.random();
    if(request) {
      var xmlDoc = getXml(request)
    } else {
      alert("An error populating input control");
    }
    document.form.submit();
  }
}
</script>
</head>
<body>
<form name="form" method="post" action="/ibi_apps/WFServlet">
<!-- Application version variables
-->
<input type=hidden name="IBIF_ex" id="IBIF_ex" value="Ajax_Sample.fex">
<input type=hidden name="IBIAPP_app" id="IBIAPP_app" value="anthonyalsford">
<!-- MRE / BID Version variables
<input type=hidden name="IBIMR_action" value="MR_RUN_FEX">
<input type=hidden name="IBIMR_sub_action" value="MR_STD_REPORT">
<input type=hidden name="IBIMR_domain" value="projmgmt/projmgmt.htm">
<input type=hidden name="IBIMR_folder" value="#skylineuhvw2">
<input type=hidden name="IBIMR_fex" value="app/Ajax_Sample.fex">
-->
<!-- Common variables -->
<input type=hidden name="WF_DESCRIBE" id="WF_DESCRIBE" value="OFF">
<input type=hidden name="IBIMR_random" id="IBIMR_random" value=0>
<table width="98%" border="0" align="center" valign="top">
  <tr>
    <td nowrap align="right" style="vertical-align:bottom;" class="aa99" width="95px">
      Select Country :
    </td>
    <td nowrap style="vertical-align:bottom;" class="aa99">
      <select id="Country" name="Country" style="width:220px;font-size:9;" onChange="form.submit();">
        !IBI.FIL.CTRYOPTS;
      </select>
    </td>
  </tr>
  <tr>
    <td height="42px" align="center" colspan="2">
      <input id=btn_submit style="position: relative; top: 10px; width: 38px; height: 22px; background-color: menu; background-image: url(/ibi_html/javaassist/ibi/html/describe/run16.gif);" type="button" value=" " onClick="run_update();">
      <input id=btn_reset style="position: relative; top: 10px; width: 38px; height: 22px; background-color: menu; background-image: url(/ibi_html/javaassist/ibi/html/describe/reset.gif);" type="button" value=" " onClick="refresh_form();">
    </td>
    <td nowrap rowspan="2" class="aa99">
      !IBI.FIL.CARDETS;
    </td>
  </tr>
  <tr>
    <td width="100px" valign="center" class="aa99">
      <input id=btn_add style="position: relative; width: 90px; font-size:9; height: 22px; background-color: menu;);" type="button" value="Add Country" onClick="add_Country();">
    </td>
    <td>
      <input id="New_Ctry" style="font-size:9;width:165px;" />
    </td>
  </tr>
</table>
</form>
</body>
</html>
-HTMLFORM END
-*

In this sample I resubmit the entire fex again but that is only so as not to overly complicate the scripting.

The real power is held within the javascript variable "request" which builds a URL the runs an adhoc fex containing the modify code.

I use this extensively in HTML pages where I do not want to reissue the execution of a fex, however, sometimes I have to introduce a small delay combined with a screen flicker to let the end user know that their update has been applied - because it can be so quick that they do not see anything onscreen.

I also use AJAX methology on larger HTML pages that require the ability to update single lines or whole pages of information - I know that I could use MAINTAIN but AJAX can be cleaner and easier to code (sorry Mark Frowner).

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report 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     [SOLVED] Adding records from an html form to a focus table

Copyright © 1996-2020 Information Builders