Focal Point
[CLOSED] Assigning !IBI.AMP.Variable in Javascript

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

November 17, 2010, 10:57 AM
<Smithj2>
[CLOSED] Assigning !IBI.AMP.Variable in Javascript
Question to all,
Can a !IBI.AMP varialbe be assigned a value in Javascript?
In the following code snippet, Focus fails to pickup the value of the pswd field

I know the reverse is supported (pswd = !IBI.AMP.PWD) so why wont this work?

<script type="text/javascript">
var pswd=prompt ("Please enter your password);
if (pswd==null || pswd=='') {
alert ("Invalid Password" + pswd);
}
else {
alert ("Valid Password" + pswd);
'!IBI.AMP.PWD;' = pswd ;
document.getElementById('field1').value='!IBI.AMP.PWD;' ;
}


Thank you for you comments in advance.

This message has been edited. Last edited by: Kerry,
November 17, 2010, 12:46 PM
Francis Mariani
You cannot use JavaScript to assign a value to a WebFOCUS amper variable.

!IBI.AMP.varname; contains the value of the variable, not the variable itself.

To achieve what you want to do, setting a form variable with the value entered in a JS prompt, try
document.getElementById('field1').value=pswd;



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
November 21, 2010, 05:43 AM
Baillecl
Bonjour,
Contains the value and not ...
I used to understand How DM and Focus used to exchange (And I really liked it. .EVAL in particular)
As to the links between MRE and Focus, I begin to get in the line, but ...
At this point I come to think that MRE is an addendum to Focus and not really a box of utilitarians present to bring services to Focus at Work.
I can't see how I can tell MRE this is an 'external variable' and please, do that for me.
MRE seems to believe that he know better and will manage all the stuff 'to help me'
I used to know a Boy-Scout who helped old ladies to cross the street, even if they did not want to...
How can one impose (in some rare cases) his will to MRE

On the Other hand, How can an old rubbish Focusian be driven in the wonderland of this brand new world without starting at level 0

How do MRE and the 2 Focuses exchange so that I can understand what happens
Thanks for advice


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO