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] passing HTML form values to fex

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] passing HTML form values to fex
 Login/Join
 
Gold member
posted
Hi,

I created a HTML form using the HTML layout painter and a separate focexec for my report procedure.

The form has a push button and when clicked would open another html file(page2) which contains 4 check boxes.
The check boxes stand for the column names in a database table, for example(dept_name,emp_name,salary,hiredate)
After selecting the relevant checkboxes, a submit on that page would take the user back to the first html(page1).

User would then enter a department number in the textbox provided and click on another submit button that executes a report procedure(agains the employee and dept table)
The report should get only the fields checked by the user in step 1.
I need to pass the checked box values in step 1 to my procedure as column names so that the procecure executes and produces reports showing only those fields(boxes that have been checked).

I know how to use amper variables to restrict data in a report but I am not sure how to dynamically populate the field names in a report.

Thanks.

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


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Virtuoso
posted Hide Post
You're going to have to use some javascript on the second form to set some (probably hidden) form 1 variables. These could then be passed as &vars to the fex. The only variables that can be passed are those that have been established in the form from which the fex is directly run.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Hi Darin,
I have never done any java scripting before. would you be able to post a small example?

Thanks much!


quote:
Originally posted by Darin Lee:
You're going to have to use some javascript on the second form to set some (probably hidden) form 1 variables. These could then be passed as &vars to the fex. The only variables that can be passed are those that have been established in the form from which the fex is directly run.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
The subject of passing values from one html page to another is all over the web, here's one page that might be helpful:

A Quick Tutorial on JavaScript Variable Passing
quote:
I created a HTML form using the HTML layout painter and a separate focexec for my report procedure.

The form has a push button and when clicked would open another html file(page2)

I am quite surprised you were able to use HTML Layout Painter to create an html launch page that had a button to open a second html page which contains a button that closes itself and returns to the main html page.


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
Gold member
posted Hide Post
Hi Francis,
I'll look up that link you provided.

The second HTML page opens on the same window, not in a new window.I used the _self,_parent attributes to do that in the Hyperlink properties.

Thanks.

quote:
Originally posted by Francis Mariani:
The subject of passing values from one html page to another is all over the web, here's one page that might be helpful:

A Quick Tutorial on JavaScript Variable Passing
quote:
I created a HTML form using the HTML layout painter and a separate focexec for my report procedure.

The form has a push button and when clicked would open another html file(page2)

I am quite surprised you were able to use HTML Layout Painter to create an html launch page that had a button to open a second html page which contains a button that closes itself and returns to the main html page.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
If I understand the behaviour of the two html pages, when you click on the button on page1, it navigates to page2, within the same web browser window, then a button on page2 navigates back to page1, within the same web browser window - are you navigating back to window history? This is not a conventional navigational method, what guarantee do you have that the previously selected values on page1 are still there? But then, I may have misunderstood.


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
Gold member
posted Hide Post
No selections are made on the first page.
The push button on the first page would take the user to the second HTML page where the user would pick the fields(for example name,sal,hiredate). A push button on this page should take the user back to the first HTML page.Then on the first page, upon entering a value in the text box, for example a dept_no,say 10, a report procedure would be executed that would produce a report with only the fields selected by the user.

I am trying to capture those checkbox selections made on the second page and pass it to the fex. Those selections would become the field names in the fex. Trying to figure out how to pass those variables to the fex?


quote:
Originally posted by Francis Mariani:
If I understand the behaviour of the two html pages, when you click on the button on page1, it navigates to page2, within the same web browser window, then a button on page2 navigates back to page1, within the same web browser window - are you navigating back to window history? This is not a conventional navigational method, what guarantee do you have that the previously selected values on page1 are still there? But then, I may have misunderstood.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Why bother with a second page? Why not simplify the navigation? On the web, have you ever experienced the kind of navigation you describe? Usually, when filling an online form, you move forward if there are multiple pages, you do not move from one page to another and then back again.


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
Gold member
posted Hide Post
Hi Francis,
I understand but those are the requirements.

Ok, If i were to make a checkbox selection on the same page, how would i capture its name and value and pass it to the fex ?

Thanks.

quote:
Originally posted by Francis Mariani:
Why bother with a second page? Why not simplify the navigation? On the web, have you ever experienced the kind of navigation you describe? Usually, when filling an online form, you move forward if there are multiple pages, you do not move from one page to another and then back again.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Virtuoso
posted Hide Post
The name of the control is the parameter name that is passed to WF. So if you have a input control which is a checkbox named CHECKBOX1 then you can check &CHECKBOX1 in your fex to see if the value is 'on'. Alternatively you can use javascript to chevk the value of document.form.CHECKBOX1 (if document.form.CHECKBOX1.checked) and set the value of your parameter as needed. This is all covered in the javascript link given earlier.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Yes, the link provided was helpful.

But how do i reference and use any javascript variable within a Fex? I need the syntax.
&CHECKBOX1 in the fex does not work. Maybe I am missing something.

I would really appreciate it if you could show me an example.


quote:
Originally posted by Darin Lee:
The name of the control is the parameter name that is passed to WF. So if you have a input control which is a checkbox named CHECKBOX1 then you can check &CHECKBOX1 in your fex to see if the value is 'on'. Alternatively you can use javascript to chevk the value of document.form.CHECKBOX1 (if document.form.CHECKBOX1.checked) and set the value of your parameter as needed. This is all covered in the javascript link given earlier.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
How much clearer do you need it?

From the link Francis gave -
<FORM METHOD="LINK" ACTION="jspass2.html">
Type your first name: <INPUT TYPE="text" NAME="FirstName"> 
Type your last name: <INPUT TYPE="text" NAME="LastName"> 
<INPUT TYPE="submit" VALUE="Click and See">
</FORM>

You'll notice that each of the text type input controls have a name attribute. That is what controls the variable name being passed to WebFOCUS. If you read the paragraphs following this example in Francis' link then you would have read
quote:
When you set up the form in this manner, what the user inputs is carried along in the URL.

You really ought to try to get some foundation in what you are being asked to do within your Company and not just rely upon the good nature of people such as Francis and Darin to dig you free. Or, at the very least, have the courtesy to actually look and read through links provided.

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
Gold member
posted Hide Post
Hi Tony,

The answer you provided is not what I am looking for.That is the javascript part which I have already done. My question was about the webfocus part. Maybe i didn't phrase my question right.I am really sorry about that.

I'll keep trying.

And, Thanks for your help guys.



quote:
Originally posted by Tony A:
How much clearer do you need it?

From the link Francis gave -
<FORM METHOD="LINK" ACTION="jspass2.html">
Type your first name: <INPUT TYPE="text" NAME="FirstName"> 
Type your last name: <INPUT TYPE="text" NAME="LastName"> 
<INPUT TYPE="submit" VALUE="Click and See">
</FORM>

You'll notice that each of the text type input controls have a name attribute. That is what controls the variable name being passed to WebFOCUS. If you read the paragraphs following this example in Francis' link then you would have read
quote:
When you set up the form in this manner, what the user inputs is carried along in the URL.

You really ought to try to get some foundation in what you are being asked to do within your Company and not just rely upon the good nature of people such as Francis and Darin to dig you free. Or, at the very least, have the courtesy to actually look and read through links provided.

T


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Perhaps more direct?
quote:
<FORM METHOD="LINK" ACTION="jspass2.html">
Type your first name: <INPUT TYPE="text" NAME="FirstName"> 
Type your last name: <INPUT TYPE="text" NAME="LastName"> 
<INPUT TYPE="submit" VALUE="Click and See">
</FORM>


You'll notice that each of the text type input controls have a name attribute. That is what controls the variable name being passed to WebFOCUS.

Using the above as an example your WebFOCUS variables would be &FirstName and &LastName.

And the code above is HTML not JavaScript.

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
Gold member
posted Hide Post
Not that I am looking for an answer but...
Precisely my point - those variables &Firstname , &Lastname are not working in my fex.
And that is exactly what i have been trying to find out; if I am missing something.

Yes, the code you provided is HTML and not Javascript but the link that was provided earlier is not just HTML but also Javascript.In either case that is not my concern.

Thanks.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Just for info, Variable names are case sensitive.

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
Virtuoso
posted Hide Post
If I go back to your very first post in this thread, is it then a correct assumption that the values for the checkboxes on the second page are not available (any more) in the final focexec?
If that is correct, then it is quite probable that you never transported the variables of the second page (the checkboxes) to the first page. Remember, the browser will only propagate variables to webfocus that are on the same page (even in the same form). So, if you want to use the checkbox values of the second page in your fex you'll have to find a way to transport them from the second page to the first and only then the submit to webfocus will carry the variables forward.
This could be done using javascript, but I find it easier to use a fex to do that. This fex will take the variables from the second page and populate the first page with the correct values.
Tip: if you want to know what &-variables are available to you after hitting the submit button, put the following two lines at the top of your fex:

-? &
-EXIT

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
Gold member
posted Hide Post
Hi dev532,
As far as I am concerned I got what are you talking about...
I am just explaining the question in more detail for better understanding of others and me also..
you have abc.htm(parent) & xyz.htm(child) two HTML Pages...you are navigating the control like this ..
abc.htm --> xyz.htm-->abc.htm

when the control comes in xyz.htm user select some fields and then goes back to abc.htm
now suppose u have selected three fields in the xyz.htm
like firstname, lastname & salary....as checkboxes.. then you want these three fields values in the abc.htm file when the control comes back to abc.htm
In abc.htm file u will take one more field as deptNo..
So now we must have four fields in the abc.htm file
and after clicking on the submit button these four fields should be passed to the fex...

I think this was your question

If I am not wrong then this question has answer through javascript..which can be solved easily..
for this you need to implement this
1) take three hidden fields in the first HTML page(abc.htm)
2) write a javascript function in the second htm(xyz.htm) which will be called on the click of submit button of second page..
3) this Javascript function will do following operation.
assign the selected value of that form to parent window's hidden variables.
Then You can use this hidden variable to pass to the fex files.
If this is the requirment of you then i can help u...if any problem...

Regards,
Anmol
Smiler


WebFocus7.6.2, WebFocus 7.1.1,Windows
HTML, PDF and Excel
 
Posts: 71 | Registered: June 30, 2009Report This Post
Gold member
posted Hide Post
Anmol,
Yes, you got it right.

In the example - abc.htm --> xyz.htm-->abc.htm
I have already written and tested the javascript to capture the checkbox names and values from xyz.htm back to the main page abc.htm.so far, good.

to make it simpler, let's forget transporting of the variables from the other page. Let's assume that there is only one page abc.htm which has three checkboxes -firstname,lastname and salary

when the user checks a box, i need to get the name (or value) of that checkbox.
For example let's say user selects only firstname and salary, then i capture these in variables in my javascript.

<script type=javascript>
var fname=document.myform.firstname.name;
var sal=document.myform.salary.name


Now, my fex is an external procedure (NOT embedded).
On the HTML layout painter, i used the hyperlink properties on the 'Submit' button to point to my fex.

-*fex looks like this
TABLE FILE EMP
PRINT &FNAME &SAL
END

the problem is it says &fname not found in fex.

I know that I am not connecting something right.

Thanks a lot for your help!


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Guru
posted Hide Post
Tony A has explained this.
The names of your checkboxes need to match your parameter names.
The values of your checkboxes need to be the corresponding field names in your datasource.

So, if you have a field named "FIRST_NAME" in your datasource.
You choose the parameter &FNAME to represent that field in your table request.
The checkbox in your html form needs to be named FNAME and its value needs to be FIRST_NAME.


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Gold member
posted Hide Post
Hi Mighty,

Thanks to all you guys for your time on this.

I got all the steps right but I know I am doing something wrong. will figure it out and post the results.

Thanks!


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Virtuoso
posted Hide Post
It seems to me that you're expecting the javascript variables to be propagated to webfocus.
That will not ever happen. The ONLY variables transported to webfocus are html input/select fields that are located within the form that calls the fex.
So in your html you need hidden fields (input type=hidden), and in your javascript you need to provide values for those fields.
Once more the tip:
if you want to know what &-variables are available to you after hitting the submit button, put the following two lines at the top of your fex:

-? &
-EXIT


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report 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] passing HTML form values to fex

Copyright © 1996-2020 Information Builders