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     Passing Amper Values to JavaScript Code.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Passing Amper Values to JavaScript Code.
 Login/Join
 
Master
posted
Greetings Forum Members,
Can I use the !IBI.AMP.ampervariable
syntax within the JavaScript
tag of my HTML?
(Up until now I've only used
!IBI.AMP to pass variables to the HTML
<input tag, and as text on a HTML page.)
For example, the following code...:
 <br /><br />-
SET &WORK = 'Hello World.';
-HTMLFORM BEGIN<br /><html>
<head><br /><Title><br /> No Title.
</Title><br />-*<br />-* 
JS code:
<SCRIPT LANGUAGE="JavaScript">
Function: setup
Disply alert box to user.
function setup() {alert
('!IBI.AMP.WORK;');
</SCRIPT><br /></head>
<body onload="setup(); 
This HTML does nothing.
</body><br /></html><br />-
HTMLFORM END<br /><br /> 
...produces an alert box,
when rendered in my browser.
The message, seen by the user,
comes from my amper variable.
Have you used !IBI.AMP within
JavaScript?
The manual only has HTML
examples, so I am double
checking the validity of this approach.
Thank you for your consideration.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 822 | Registered: April 23, 2003Report This Post
Platinum Member
posted Hide Post
We are using !IBI.AMP references to set variables in JavaScript (see below):

var checkNum = !IBI.AMP.CHK_NUM;

If using the !IBI refence directly in the alert doesn't work, set a var first and then use that. Best thing to do is try to run the code as you've written it -- see if it works.
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
Expert
posted Hide Post
David, you might want to pass the &var directly
using the pipe | escape character for the &.
&|myvar will stop focus from prompting for a value for &myvar.
You might find this approach simpler than the !ibi.amp syntax
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
I stick with the !IBI.AMP. form. It allows you to move HTMLFORM code unchanged between a fex (inline within -HTMLFORM BEGIN/END) and an htm file (referenced as -HTMLFORM filename).

You can imbed !IBI.AMP. references in JS code within the scope of -HTMLFORM, whether in-line or free-standing, wherever the underlying character-string would be called for. Just bear in mind what the JS code must look like in the final html document that webfocus returns:

- If JS expects a string, surround the !IBI.AMP.varname; ref with quotes.

- If JS expects a JS var name or a numeric expression, omit them.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
Greetings codermonkey and Jack,

Thank you for confirming that you have used
!IBI.AMP.variable within your JS code (JS code within the scope of -HTMLFORM).

Thank you also for your additional comments and suggestions.

Regards,
Dave
 
Posts: 822 | Registered: April 23, 2003Report 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     Passing Amper Values to JavaScript Code.

Copyright © 1996-2020 Information Builders