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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Call javascript function from Maintain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Call javascript function from Maintain
 Login/Join
 
Gold member
posted
Hi,
Is there a function to call a javascript program from Maintain. For example, to call Maintain from javascript use IWCTrigger. I need to go in the opposite direction.
Thank you,
Nick

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


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Expert
posted Hide Post
Where do you want to call from ?

Here is an interesting way to make a piece of dynamic javascript in Maintain.

Step 1: Create an empty javascript file.
Step 2: Add the javascript file to the form, not as a link.
Step 3: scriptfilename.lines(scriptfilename.lines.FocCount + 1) = 'javascript line;' ;

In you maintain code add step 3 before showing the form, then the scrip line will be executed when the HTML form in loaded.

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


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Hi Waz,
Thanks for the quick response.
I want to send emails to selected reciepients with a custom user entered message for each receipient. I have a routine, provided by Mark, that sends emails launched via the onclick event.

I would like to use this javascript code to send emails to selected receipients. Since each receipient will have a customized message, I have to send multiple emails. The process that evaluates if an email will be sent is in Maintain.

High level logic is:
IF EMAILIND EQ 'Y' THEN "CALL EMAIL Javascript";

Hope this helps.

Thank you,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Expert
posted Hide Post
Have a look at the maintain below, it may show you what I am suggesting.

jscall.mnt
MAINTAIN
$$Declarations
Case Top
Winform Show Form1; 
EndCase
END

<folder name="Forms">

	<form inprocid="1" stylesheet="Default" cursorpointer="0" scrollingview="1" scrollviewheight="10000" scrollviewwidth="10000" tooltiptext="" helpanchor="" name="Form1" backimagetiling="0" isbackimageboundtovar="0" layerinsertindex="0" nextnewlayerid="1" title="Untitled" gridflags="6" gridsize="655370" margin_left="10" margin_top="10" margin_right="10" margin_bottom="10" nodeid="2573" lastuniqueid="3">

		<jscriptinform nodestate="1" nodeid="2572" namestline="0" namestcol="0" nameendline="0" nameendcol="0" name="jscall" path="IBFS:/localhost/DEV/tests/jscall.js" embed="1" datatype="reference" refnodeid="461"/>

		<layer name="Default" layerid="0" visible="1" locked="0"/>

		<control caption="Process" defaultbutton="0" tabstop="1" shape="0" uniqueid="0" nodeid="2574" classname="IWCControlButton" id="262" name="Button1" groupid="-1" layerid="0" isboundtovar="0" enabled="1" zindex="0" left="60" right="130" top="40" bottom="80" group_left="0" group_right="0" group_top="0" group_bottom="0" tabindex="0" nodestate="2"/>
		<control caption="Exit" defaultbutton="0" tabstop="1" shape="0" uniqueid="2" nodeid="2575" classname="IWCControlButton" id="262" name="Button2" groupid="-1" layerid="0" isboundtovar="0" enabled="1" zindex="1" left="60" right="130" top="100" bottom="140" group_left="0" group_right="0" group_top="0" group_bottom="0" tabindex="1"/>
		<events name="events" nodestate="1">
<eventhandler objectuniqueid="0" nodeid="2839" eventhandlertype="1" param="" paramnames="" htmlname="click" classname="IWCEvent" id="X15" name="Click" objdescription="" procname="" appname="">
<![CDATA[jscall.lines.foccount=3;
jscall.lines(jscall.lines.FocCount + 1) = 'showMsg("Message Text1");' ;
jscall.lines(jscall.lines.FocCount + 1) = 'showMsg("Message Text2");' ;
]]>
</eventhandler>
<eventhandler objectuniqueid="2" nodeid="2840" eventhandlertype="1" param="" paramnames="" htmlname="click" classname="IWCEvent" id="X710" name="Click" objdescription="" procname="" appname="">
<![CDATA[self.WinExit();
]]>
</eventhandler>
</events>
</form>
</folder>


jscall.js
function showMsg(txt) {
 alert(txt);
}


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Hi Waz,
Thanks again!

Calling the javascript function from a button is functioning properly but I need to call the javascript function from the Maintain procedure. For example,

jscall.mnt

MAINTAIN
$$Declarations
Case Top
Winform Show Form1;
EndCase
Case email
compute to/a100='nick@njginc.com';
compute from/a100='nick@njginc.com';
compute subject/a100='hello';
compute body/a100='this is a test';
call jscall
endcase
END


Currently, the form has a button where the js code is as follows:

webpage = "http://xxx:8080/approot/xxx/test4.jsp";
getTo = document.getElementById("To_Edit").value;
getFrom = document.getElementById("From_Edit").value;
getSubj = document.getElementById("Subject_Edit").value;
getBody = document.getElementById("Body_Edit").value;
url = webpage + "?getTo=" + getTo + "&getFrom=" + getFrom + "&getSubj=" + getSubj + "&getBody=" + getBody;
window.open(url,"emailwin");


I need to perform the same activity in Maintain code or call a js function from Maintain that has the code above.

Thank you,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Virtuoso
posted Hide Post
Nick,

If the only function of the maintain is to call a js functions, then you might be better off writing a html solution for your problem.
Calling js from maintain can't be done as is. You'll have to do this through some action within maintain that is linked to a javascript function. It can be a js linked to a button, which gets executed upon clicking the button, or linked to the form, which gets executed when the form gets loaded. If you don't have forms, then sorry, no javascript functionality.
In your case it seems you have a form. Then I'd try to put all the data you need to send out on the form (hidden or not) and have a javascript program read all this data and process it. Link the javascript to the form in such a way that it gets executed when the form loads.

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 GamP and Waz,
Thanks for your help. So far, with assistance from you and my friends at IBI, I've been able get it to work by using an HTML object as follows:
1. Populate a stack with the javascript statements.
2. Use the stack as the data source for the HTML object.
3. Trigger execution of the HTML object by a form refresh.

This solution assumes that the form will remain open and the HTML object will be triggered by a form refresh. Since the objective is to send emails to selected individuals each with a customized message, this works but the user will have to click a second button to exit this form. This is no biggie, I think.

Thank you,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Expert
posted Hide Post
Nick, what I gave you does call a js function from maintain. the example has the button to call a maintain case. This case then populates the js code embedded in the winform with the js call.

If I understand you correctly this will work for you.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
the user will have to click a second button to exit this form

Couldn't you, after the js is done, code a window.close() and a IWCTrigger("WINEXIT") to close the form and the maintain?


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 Waz and GamP,

The original concept was a user would set the email indicator for that person to 'Yes', state a customized message in a comments field and the email would be sent upon leaving that person's record. Since there are a number of ways to leave the person's record and the approver may exit after entering a person's record, I choose to trigger the email creation and distribution process from a button. So, Waz your technique will work and I will compare solutions later today. GamP, I will integrate your suggestions to close the page and post a message.

Thank you both for assisting me as I am a seasoned FOCUS programmer but relatively new to WebFOCUS and javascript.

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report 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] Call javascript function from Maintain

Copyright © 1996-2020 Information Builders