Passing a value from JavaScript to WebSpeed

Chris Kelleher

Administrator
Staff member
Hi,

Here is an example of what I am trying to do

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
IF vcount = 2 THEN
DO:
{&OUT}
'~&lt;script language="javascript"~&gt;~n'
'var abstyp = "Start";~n'
'prompt("Two records exist for this absence. Please Enter
Start/end", abstyp);~n'
' ~' ASSIGN vabs-type = ' abstyp '. ~';~n'
'~&lt;/script~&gt;~n'
{&END}
END.
[/code]

I am doing some processing using PROGRESS, then prompting the user using
Javascript which is embedded inside
the PROGRESS code. My problem is trying to capture the response from the
user and assigning the response to
a PROGRESS variable.


regards

Ali OMRAN
Analyst/Programmer
KCS Management System
 

Chris Kelleher

Administrator
Staff member
Ali,
I think you are missing a major issue here. Javascript is
client-side and webspeed is server-side. You have to send the javascript
variable to webspeed on the server, and that requires a submit. (thats how I
do it) Your javascript might work like this

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
&lt;script language=javascript&gt;
funtion dowork()
{
var abstyp = 'start';
prompt('Two records exist for the absence. \nPlease enter
Start/end', abstype);
document.form-name.submit();
{
&lt;/script&gt;
[/code]

In you webspeed program you would make the call in the main body section.

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
abs-type = get-field("abstype":U).
[/code]

Now the javascript variable is in your webspeed program. I hope this answers
your question


Cameron David Wright
perotsystems
TDY @ TRW Automotive
 
Top