NetTalk Central

Author Topic: running clarion code from a menu  (Read 4272 times)

lanmicro

  • Full Member
  • ***
  • Posts: 112
    • View Profile
    • Email
running clarion code from a menu
« on: July 28, 2011, 12:01:45 PM »
Hi Guys,

Using NT5.29, I want to update a session variable from a menu item and have the menu refresh.  (The session variable determines what the menu shows).

  if p_web.GSV( 'l:CbAskExperts' )
    l:CbAskExperts          = 0
    p_web.SSV( 'l:CbAskExperts', l:CbAskExperts )
  else
    l:CbAskExperts          = 1
    p_web.SSV( 'l:CbAskExperts', l:CbAskExperts )
  end!if

This is the code I want to run but I can't seem to find a place to add the code so that it executes only when my menu item is clicked on.

Any suggestions?
Gregory C. Bailey

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: running clarion code from a menu
« Reply #1 on: August 01, 2011, 04:38:40 AM »
Haven't done this, but my best guess would be that you can't add the code in the procedure that contains the menu. It only builds the menu in html which will call the next procedure - that's it. So you should be adding the code in the procedure that is being called. You can also add a stub-procedure that is the new procedure that gets called from the menu item. And all you do in there is to run your code and then call the original target procedure.

Thys

lanmicro

  • Full Member
  • ***
  • Posts: 112
    • View Profile
    • Email
Re: running clarion code from a menu
« Reply #2 on: August 03, 2011, 06:51:18 AM »
Hi Thys,

I guess the sticking point is there is no next procedure<G>.  I am just attempting to change the state of the session.  From not showing some menu items to showing those menu items.

I've got it working to some extent by calling a form with no fields in it and pressing the save button.  What I would like is to not have to have the end user press the save button and have the form autosave.

Any ideas about that?
Gregory C. Bailey

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: running clarion code from a menu
« Reply #3 on: August 08, 2011, 03:45:59 AM »
Hi Gregory,

Maybe try a normal source procedure, but pass the value p_web to it, ie

DoIt(p_web)

and in the DoIt procedure you have

ProtoType   (NetWebServerWorker)
Parameter   (p_web)

Cheers
Charl

lanmicro

  • Full Member
  • ***
  • Posts: 112
    • View Profile
    • Email
Re: running clarion code from a menu
« Reply #4 on: August 08, 2011, 08:11:25 AM »
Hi Charl,

Thanks for the suggestion, but I get a "The page cannot be found" error, when I tried it.
Gregory C. Bailey