"Confirm" Javascript

erikazoppello

New Member
I need a help to use the function "confirm" (Javascript) into Progress Program.

Example:

PROCEDURE ValidateForm:
DEFINE OUTPUT PARAMETER lOK AS LOGICAL NO-UNDO.
{&out}
'<script>var resp = confirm("Confirma o envio ?")~;</script>' SKIP.

lOK = get-value("resp").
END.

But "lOK" return empty.
 

Casper

ProgressTalk.com Moderator
Staff member
Hi Erika,

Javascript is executed in the browser. The progress program is executed on the Agent. So there is no direct connection between those two.
A 'normal' structure of a WebSeepd program is (I don't like cgi-wrapper that much so I normally do a run of an htmlform with speedscript):

Procedure makeform:
/* gather information */
/* put information in temptables */
Run form.html(input temptable).

The form.html contains the html and javascript of the form with some speedscript to get stuff from the database in it.

I pressume you have a stateless application and you don't wait in your application for the submit of a form. So what you basically do is sent the webpage back to the browser and react when it is submitted again. With sessionmanagement you always keep track which session is submitted. So the only thing you have to do to catch "resp" in your case is making a hidden field in the webpage. (<input type="hidden" name = "resp">
if the form is submitted you use a javascript function which fills the hidden field. (you could do that with DHTML --> onsubmit.)
something like document.form.resp.value=resp. Just make sure the variable is known over the enire procedure so declare it at the beginning of your script block outside the functions.

After submit you can use in your Progress procedures the get-value function to use the value within Progress.

HTH,

Casper.
 
Top