Focal Point
[solved] Report to HTMLFORM

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

May 11, 2015, 02:03 PM
Enigma006
[solved] Report to HTMLFORM
Hello

Below is my sample code and I am sending values typed in textbox to different fex.
  
DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END


Data from text boxes goes in as &VALUES1, &VALUES2 etc.

My question is..I want to send data from COUNTRY field in similar way. How can I do that?
Please suggest.

Thanks

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


8.1.05
HTML,PDF,EXL2K, Active, All
May 11, 2015, 03:21 PM
GavinL
If I understand your question, your wanting to send "Country" data as well as your TEXTBOX data?

If so are you wanting them to be in sync or tied together in some way?

For example:
ENGLAND:VALUE1
FRANCE:VALUE2

Also note, your hard coding the ID on your input, so your going to get an array back when you post it as they are all ID = VALUES1 and a name of VALUES.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 11, 2015, 03:30 PM
GavinL
Like this?

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
COUNTRY/A200 = '<INPUT TYPE=HIDDEN ID="COUNTRY" NAME="COUNTRY" VALUE="' || COUNTRY || '"/>' | COUNTRY ;
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 11, 2015, 03:33 PM
Enigma006
quote:
Originally posted by GavinL:
Like this?

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
COUNTRY/A200 = '<INPUT TYPE=HIDDEN ID="COUNTRY" NAME="COUNTRY" VALUE="' || COUNTRY || '"/>' | COUNTRY ;
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END


thanks gavin..that worked. I am writing my define wrong, so the value was not passed. it works now. perfect.
Can COUNTRY field be hidden (with NOPRINT) and still can data be sent? I tried but it does not work. If field is being printed, then values are sent.

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


8.1.05
HTML,PDF,EXL2K, Active, All
May 11, 2015, 03:52 PM
GavinL
No, when you use NOPRINT, it hides everything from display and is used only for sorting.

This is why I named the define the same thing as the field, replacing it with the hidden INPUT along with the real data.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 11, 2015, 03:54 PM
GavinL
If your wanting to just send country without it being displayed then you will have to do the displaying differently. I'll put together some example code for ya.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 11, 2015, 04:00 PM
Enigma006
quote:
Originally posted by GavinL:
If your wanting to just send country without it being displayed then you will have to do the displaying differently. I'll put together some example code for ya.

Thank you so much..will keep trying.


8.1.05
HTML,PDF,EXL2K, Active, All
May 11, 2015, 04:13 PM
GavinL
Try this.. Keep in mind, you will need to trim the values once submitted, as FOCUS loves to add spaces to values, since it has no concept of VARCHAR.

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE HOLD AS RPT1 
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
}
function TrimData(o){
	document.write(o.trim());
}
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">

<table border cellpadding=1>
<tr>
	<td align=RIGHT valign=BOTTOM>SALES</td>
	<td valign=BOTTOM>TEXTBOX</td>
</tr>
-REPEAT HENDNUM &LINES TIMES
-READFILE RPT1
<tr>
	<td align=RIGHT>!IBI.AMP.SALES;</td>
	<td>
		<INPUT TYPE=HIDDEN ID="COUNTRY" NAME="COUNTRY" VALUE="!IBI.AMP.COUNTRY;"/>
		<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>
	</td>
</tr>
-HENDNUM
-ENDLOOP
</table>

</form></body></html>
-HTMLFORM END




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 11, 2015, 04:15 PM
GavinL
actually, you don't even need that Define anymore, since I've added it to the loop.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 10:08 AM
Enigma006
quote:
Originally posted by GavinL:
actually, you don't even need that Define anymore, since I've added it to the loop.


Looking for any other way to do this. This requires all formatting done in HTML like colors, font etc.


8.1.05
HTML,PDF,EXL2K, Active, All
May 12, 2015, 10:50 AM
GavinL
To pass country, it's required to be part of the results. Since your telling it to output HTML, then it's going to show up if it's a result. NOPRINT will still show the column, just not the data.

I'm can't think of another way to do it.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 10:52 AM
GavinL
Just as I say that, I had an idea and it worked.. It's still there just closed up.. Based your style if you have no borders, then it will not be visible.

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
COUNTRY/A200 = '<INPUT TYPE=HIDDEN ID="COUNTRY" NAME="COUNTRY" VALUE="' || COUNTRY || '"/>';
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY AS ''
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 11:02 AM
GavinL
I think I found a post that may help you..

http://forums.informationbuild...1057331/m/4837047916

quote:

If it's an HTML report, then you can reference an external stylesheet:
ON TABLE SET HTMLCSS OFF
ON TABLE SET CSSURL '/approot/project/stylesheet.css'


In that stylesheet you can add a CSS class definition that says:
.hidden { display: none; }

In your report style sheet you can assign that class to a column like so:
TYPE=TITLE, COLUMN=Nx, CLASS=hidden,$
TYPE=DATA, COLUMN=Nx, CLASS=hidden,$




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 12:18 PM
GavinL
Yes, the above worked for me..

I created a folder in the:
C:\ibi\apps\ folder called "gavin". I put the following code in a mytest.css:
.hidden { 
	display: none; 
}


I then used the following code, which hides the country column and still uses it to submit.

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE SET CSSURL '/approot/gavin/mytest.css'
ON TABLE HOLD AS RPT1 FORMAT HTML
ON TABLE SET STYLE *
COLUMN=COUNTRY, CLASS=hidden,$
END

-HTMLFORM BEGIN
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 01:48 PM
Dan Satchell
It's also possible to put the CSS inline:

DEFINE FILE CAR
TEXTBOX/A200 = '<INPUT TYPE=TEXT ID="VALUES1" NAME="VALUES"/>';
END
TABLE FILE CAR
SUM
	SALES
	TEXTBOX
BY COUNTRY
ON TABLE SET CSSURL '/approot/gavin/mytest.css'
ON TABLE HOLD AS RPT1 FORMAT HTML
ON TABLE SET STYLE *
COLUMN=COUNTRY, CLASS=hidden,$
END

-HTMLFORM BEGIN
<style type="text/css">
.hidden {display:none;}
</style>
<HTML>
<SCRIPT id=IBI_OptionsScript type=text/javascript>
function Submit(){
     document.forms[0].submit();
 }
</SCRIPT>
<BODY style="OVERFLOW: auto">
<INPUT id=button1 tabIndex=1 value=SUBMIT onClick=Submit(); type=button name="button1">
<form id=abc target="iframe1" action="/ibi_apps/WFServlet" method="get">
<input type='hidden' name="IBIF_ex" id="IBIF_ex" value="bid/input_procedure_data">
 !IBI.FIL.RPT1;
</form></body></html>
-HTMLFORM END



WebFOCUS 7.7.05
May 12, 2015, 02:22 PM
Enigma006
Thanks so much Gavin and Dan for your help. Hidden class trick seems to be working for my situation.


8.1.05
HTML,PDF,EXL2K, Active, All
May 12, 2015, 03:12 PM
GavinL
Glad to see it work for you, Eniqma006..

quote:
Originally posted by Dan Satchell:
It's also possible to put the CSS inline:


Dan, just for my info, how did you get it to work? When I add the inline style and remove the "ON TABLE SET CSSURL '/approot/gavin/mytest.css'", WF thinks there isn't a style, so it removes the class from the COUNTRY TD tag.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 12, 2015, 03:44 PM
Dan Satchell
@ GavinL: Weird. If you remove the SET CSSURL command, it doesn't work. But by pointing CSSURL to any nonsensical file (e.g., ON TABLE SET CSSURL 'testx.css'), it works fine. I tried replacing SET CSSURL with "SET HTMLCSS ON" and that didn't work.


WebFOCUS 7.7.05
May 12, 2015, 03:47 PM
Enigma006
quote:
Originally posted by Dan Satchell:
@ GavinL: Weird. If you remove the SET CSSURL command, it doesn't work. But by pointing CSSURL to any nonsensical file (e.g., ON TABLE SET CSSURL 'testx.css'), it works fine. I tried replacing SET CSSURL with "SET HTMLCSS ON" and that didn't work.


Dan, its true. I pointed to non-existing CSS file, it still worked. So it surprised me but I went ahead with inline CSS.


8.1.05
HTML,PDF,EXL2K, Active, All
May 13, 2015, 09:48 AM
GavinL
Ha.. Sounds like a feature.. Smiler



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server