Focal Point
[CLOSED] Passing parameters using -HTMLFORM

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

June 21, 2019, 03:21 PM
Deej
[CLOSED] Passing parameters using -HTMLFORM
I have a simple HTML form (FORM1) with edit boxes for "Salesperson ID" (linked to a parameter &SalespersonID) and "Customer Number" (liked to a parameter &CustNum) that I need to pass to another HTML form (FORM2) when the "Add" button is pressed.

Image 1 link

Currently, I have the action on the "Add" button linked to a .fex file that contains only one line of code...

-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm


When the "Add" button is pushed, it runs the .fex and pulls the "comm_add.html" file exactly as I want it to... but now I need to pass the parameters from the two edit boxes to the "comm_add.html" so those two columns are filled in when the "comm_add.html" HTML page loads.

Image 2 link

Does anyone know of a way to pass the parameters from FROM1 to FORM2 using the -HTMLFORM code? Or, FOCEXEC?

I am currently using this method in a different part of my HTML page (FORM1), but this part pulls a .fex file first, then I have a link on one of the columns that passes the parameters through the -HTMLFORM .fex file (call_update_form.fex) and then on to FORM2 using a normal FOCEXEC statement:

TYPE=DATA,
     COLUMN=N17,
     FOCEXEC=IBFS:/WFC/Repository/BM_Commissions/Maintenance/call_update_form.fex( \
     SALESID=N1 \
     S4EMPN=N3 \
     S4CNUM=N4 \
     S4ALPH=N5 \
     S4AORI=N6 \
     S4SLMN=N7 \
     S4FROM=N8 \
     S4TOTO=N9 \
     S4SCOP=N10 \
     S4POOL=N11 \
     S4PLAN=N12 \
     S4SHAR=N13 \
     S4PCNT=N14 \
     S4CCOD=N15 \
     S4WHEN=N16 \
     ),
          TARGET='_self',
$  

This message has been edited. Last edited by: FP Mod Chuck,



WebFOCUS 8.1.05
Windows, All Outputs
June 21, 2019, 03:40 PM
FP Mod Chuck
Deej

This is an untested answer but you should be able to reference the parameters with the !IBI.AMP.parmname; syntax where parmname is the case sensitive name of the parameter on your initial screen.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 21, 2019, 04:45 PM
Deej
As in changing the .fex code in my "Add" button link?

From:
-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm


To:
-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm
 !IBI.AMP.SalespersonID;
 !IBI.AMP.CustNum;


If so, that's not doing the trick.

Not sure of the syntax for a -HTMLFORM statement to send the parameters... I'm assuming what I have above in the "To:" section is correct syntax-wise?

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



WebFOCUS 8.1.05
Windows, All Outputs
June 26, 2019, 01:07 PM
FP Mod Chuck
DeeJ

I think the references to !IBI.AMP.SalespersonID;
!IBI.AMP.CustNum; need to be inside the htm file as a hidden field.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 26, 2019, 02:17 PM
Deej
Thanks for the reply Chuck,

The &SalespersonID and &CustNum parameters are already in the htm file, but I'll take a look to be for sure.



WebFOCUS 8.1.05
Windows, All Outputs
June 26, 2019, 04:04 PM
John_Edwards
You need to embed your amper variables into the url you're calling in the focexec. In your focexec, make your line of code something on the lines of this --

-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm?SalespersonID=&SalespersonID&CustNum=&Custnum


Your two amper variables will resolve at runtime to their passed values. Something the lines of --

-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm?SalespersonID=0012345&CustNum=06762


This is your goal. That url is how you pass form variables on web-based systems. The html form specification uses a ? to start the list of variables, an ampersand between each to separate them.

But there's a little complexity here, because your focexec is going to want to resolve that ampersand before the CustNum parameter into an amper variable. You're in a focexec after all. That will hose the text of your url call.

-HTMLFORM IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm?SalespersonID=001234506762=06762


You very likely need to use a -SET command to assemble your url from two pieces prior to the HTMLFORM command, something like this --

-SET &URL_CALL = 'IBFS:/WFC/Repository/BM_Commissions/Maintenance/comm_add.htm?SalespersonID=&SalespersonID&' || 'CustNum=&Custnum' ;


Note the concatenation after SalespersonID. That separates the ampersand from the text that follows. FOCUS will leave it alone. Then you make your call with --

-HTMLFORM &URL_CALL


I'm just shooting from the hip so I'm sure there's a few errors hiding in what I show above, but that's the concept. You're hand-assembling a Method=Get html form call on the url line, which WebFOCUS is more than happy to take and pull amper variables out of.

I've done this about 100 times, though usually I'm doing it in javascript inside a focexec. The concept is the same though, and it works well up through 2048 characters. After that you have to create a Post form call, which is an advanced topic!

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



June 26, 2019, 04:25 PM
Deej
Makes PERFECT sense John, thanks!

I'll give that a shot!



WebFOCUS 8.1.05
Windows, All Outputs
June 27, 2019, 09:34 AM
Deej
John,

I gave your suggestion a shot this morning and I've tried as many variations of your &URL_CALL that I can think of... even putting the actual parameter values into the -SET line.

Everything I've tried gives me the exact same error:
 
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 
- <ibfsrpc _jt="IBFSResponseObject" language="EN" localizeddesc="Names cannot contain any of the following characteres: Space&*()|:;",?/" name="runAdHocFex" returncode="8017" 
returndesc="Names cannot contain any of the following characteres: Space&*()|:;",?/" subreturncode="0" subsystem="" type="simple">
 




WebFOCUS 8.1.05
Windows, All Outputs
June 27, 2019, 09:53 AM
John_Edwards
Can you see the url that results from the call?

You may be able to do

-HTMLFORM http://servername/ibi_apps/ . . .

. . . instead of the IBIFS in order to get your elaboration fully controllable and correct.

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