NetTalk Central

Author Topic: Interacting with a javascript "confirm" box  (Read 3463 times)

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Interacting with a javascript "confirm" box
« on: August 23, 2012, 01:39:24 AM »
I can display a javascript confirm box using following:
p_web.Script('var r=confirm("Press a button"); if (r==true) {{x="You pressed OK!";} else {{x="You pressed Cancel!";}')

However, I am not sure how I could then act on the selection in my Clarion code?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
Re: Interacting with a javascript "confirm" box
« Reply #1 on: August 23, 2012, 02:17:55 AM »
Your clarion code creates the JavaScript and sends it to the server.

The JavaScript then does another request if you want the action to go ahead.

Remember this is all completely asynchronous, so you need to think in a very request / response kind of way. (and remember each request starts a new thread...)


ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Interacting with a javascript "confirm" box
« Reply #2 on: August 23, 2012, 02:40:56 AM »
Thanks Bruce. I realise that there cannot be any direct communication and was thinking that maybe the javascript could set a session variable that could then be read? Is that possible and what javascript code would do that?