Focal Point
javascript in fex [closed]

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

March 04, 2010, 10:33 PM
Yangyang
javascript in fex [closed]
hello all,

I have a problem with javascript in fex.

this is my code.

------------------------
in main.htm :

function testMain()
{
test1();
alert("testMain");
}

function test1()
{
document.form1.IBIF_ex.value = test.fex;
document.form1.IBIMR_fex.value = test.fex;
document.form1.submit();
}

function test2(label,ctrl)
{
alert("test2");
//document.form1.label.text=ctrl
document.getElementById(label).text=ctrl;
}


---------------------

in test.fex

-HTMLFORM BEGIN
<_html><_head><_/head>
<_body onload="test2['label1','testlabel');test2['label2','testlabel');test2['label3','testlabel');"
<_form>
<_/form>
<_/body>
<_/html>
-HTMLFORM END



when i run the html ,alert("testMain") don't displey.

i check the function test2()
i found the alert("test2") display once,but the label1,label2,label3 , three of them all display "testlabel".

i don't konw what's worng with the code....

can anyone help ?

thanks,
Yang

This message has been edited. Last edited by: Yangyang,
March 04, 2010, 10:51 PM
Waz
Our onload event calls test2 multiple times.

test2 tries to set the text for label tothe value of ctrl, but your form does not have an object named label.

Did you get a javascript error. In i.e. there should be a yellow triangle in the status bar at the bottom left of the window. If you double click on it, it will tell you the error.

did you pist the entire htmlform ?


Make sure that you post your code between the code tags. use the button
</>



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 05, 2010, 12:48 AM
Yangyang
Hi Waz,

thank your help.

the javascript in html is demo.

i'm sorry i didn't write in correct way.

the code is ok , not found error.

: )

in this bbs , when i use : < / > , it's will be transform, so i used <_/> style .

Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
March 05, 2010, 08:45 AM
Francis Mariani
Yangyang,
When Waz specified to use </> , he meant to use the right-most button in the forum Message window - clicking this button will insert
[code]
[/code]
tags - you should always post program code between these tags. Either edit your original posting or repost the HTML and JavaScript code - placed between these code tags.


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
March 05, 2010, 11:53 AM
gweller
Watch your parenthesis when calling js functions

Use()
not[)


WebFOCUS 8201M/Windows Platform
March 10, 2010, 02:56 AM
Yangyang
Thanks all,

this problem i till don't fix it ,

but i want to close this Discussion , how to do it ?

Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
March 10, 2010, 03:56 AM
Ram Prasad E
Use "Edit or Delete Message" option of initial post. There you can edit the title to add [CLOSED].


WebFOCUS 8.1.05
Windows
http://ibiwebfocus.wordpress.com
https://www.facebook.com/groups/ibi.webfocus/
March 10, 2010, 10:44 AM
gweller
If I can add one more suggestion priuor yo you closing

remember that the usual way of linking a fex into a HTML file is via a iframe.

This means that referencing a js function that is residing within the parent HTML file must be referenced using the parent keyword

you may also simply relocate the js function to the htmlform tag within your fex

thanks and good luck


WebFOCUS 8201M/Windows Platform