Focal Point
use javascript in a fex-file... possible?

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

November 11, 2004, 02:12 PM
Ernst
use javascript in a fex-file... possible?
Hi @all!
Is it possible to use javascript in a fex file?
example: i have a form in a html file.. i select a value from a dropdown-field. this value i want to use as a variable in an fex and work with it..
hope you can guess what i wanna do ;-)
are there any suggestions how to use javascript in a fex???
maybe:

-SET value1 = document.form.element.options[xyz].text

is there something like that???
furhter info: th htmlpage is created as htmlform from the fex-file...

mission impossible???
November 12, 2004, 06:27 PM
<Pietro De Santis>
Ernst, please provide more details.

The -SET command you mentioned is in the FEX before the HTMLFORM is displayed or is it in the FEX that's called after the submit button is clicked on in the HTMLFORM?

Pietro.
November 12, 2004, 07:43 PM
Bob Jude Ferrante
You can include javascript in a FEX if you use HTMLFORM syntax. We do this all the time. You can have the script appear as functions or as inline in a [script] block and call them via onxxxx events in your HTMLFORM.

If you've got a report and want the HTMLFORM to embed it, hold the report to a FORMAT HTMTABLE file and then use the standard !ibi.file.filename; syntax to embed it. You can place it anywhere. Very powerful stuff, similar to ASP or JSP in many ways.

Hope this helps.

Bob
November 15, 2004, 11:31 AM
Ernst
ok, i try to explain it from another point..

i have a form on an html page. a drop-down field where i can select years.

and if i select a year, i will use this value in a fex as a variable, to show me tables with values only in this year...

i tried to fetch the value with javasript, and it works, but now i dont know how to bring the value into the fex..thats my problem...

can you guess now, what i want? ;-)
November 15, 2004, 11:55 AM
RB
Hi Ernst,

I think you want to populate the dropdown value form a fex and then you want to pass that value selected from the drop down to another FEX is that correct?

This is what I do.

DEFINE FILE CAR
CARNAME/A150 = '<OPTION VALUE="'|| CAR_MODEL ||'">'
| CAR_MODEL | '-' | CAR_DESC | '</OPTION>' ;
END

TABLE FILE CAR
SUM CARNAME
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY'
ON TABLE HOLD AS HOLD1 FORMAT DD ALPHA
END

-HTMLFORM BEGIN
...
...
...
...
...
..
<!-- BELOW IS THE DYNAMIC DROPDOWN BOX -->
Choose CARNAME:<TD width="236">
<p align="left"><SELECT NAME="CAR_MODEL ">!IBI.FIL.HOLD1;
</SELECT><BR></TD>
</TR>
<input type='hidden' name='IBIMR_domain' value="XYZ1">
<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_fex' value="car1.fex">
<input type='hidden' name='IBIF_ex' value="car1.fex">
<input type='hidden' name='IBIMR_folder' value="#xyz2">
<input type='hidden' name='IBIMR_defer' value="">
<input type='hidden' name='IBIMR_random' value=''>


-HTMLFORM END

Now the carname value that you select would be passed to CAR1.fex.

Does that help or did I deviate from the actual question?
November 15, 2004, 03:21 PM
TexasStingray
Ernst

If I understand you! you can use the onClick or onChanged event of the dropdown and then call the form.submit() function to submit the form to webFOCUS. The submit function will automaticlly pass all variables that are in to form section for the HTML file back to WebFOCUS. For example: if I have a field called COUNTRY which is a select box I can trigger an event to call WebFOCUS and the variable &COUNTRY will automaticlly be pass back to WebFOCUS.

Hope This Helps
November 16, 2004, 04:51 PM
Ernst
thanks for answering so fast.. but as a newbie, its not very clear to me.. where ist the variable in the fex? i dont want 2 fex.. its just one fex and one html file..
there is a start value, its the actual year.. and a dropdown box is filled with the years where there are datasets..
and in the html is a table with values only from the year which is selected from the drop down above..
till now, everything is ok and working!!
but if i change the dropdown box to another year.. ther are just mistakes, or i allways get the starting year.. so there is the problem.. i dont know what to do, to get the values of the selected year into the table...

so: i have a fex to get the years

KURZDAT/MDYY=HDATE(DATUM,'MDYY');
JJ/YY=KURZDAT;
PART1/A15 = '';
END
TABLE FILE STUNDEN
SUM
PART1 JJ PART2 JJ PART3
BY
JJ NOPRINT
ON TABLE HOLD AS DYNAMLST FORMAT ALPHA
these small fex i have included
in another fex with an "EX" execution on the beginning..

and in the second fex i want to create a table
with values just from the selected year..
but i really dont know, how i get a variable into the second one which shows these values..

in the html-file there are the form & select & value tags.. and with javascript-onchange i would like to make the page reloading and use the new year-values...

hope that someone is understanding me, and can show me a simple solution.. would be great from you!! thanksssssss!

This message has been edited. Last edited by: <Mabel>,