NetTalk Central

Author Topic: Calling Source procedure from Menu  (Read 685 times)

mmelby

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Calling Source procedure from Menu
« on: October 06, 2023, 12:54:27 PM »
I have not done this before so I am probably missing something easy. I added a button to my menu. It calls a regular Clarion Source Procedure. I have 3 clarion statements in the Process Code embed.

I do not get any compile errors but when I click the button I get a "The page cannot be found" error. I am not trying to display any HTML. There is no HTML in the procedure. I don't want to display anything. I just want the code to run.

I have created an example app using the wizard that shows this behavior. It has the App, Dct, and a test file. The button says "Clear File Records".

I didn't find anything helpful when I searched. Any help is appreciated.

Regards,
   Mike

Jane

  • Sr. Member
  • ****
  • Posts: 349
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Calling Source procedure from Menu
« Reply #1 on: October 06, 2023, 04:49:31 PM »
Well, your menu and javascript are in the browser.  Your ClearFile procedure is in the server.  Your menu item is trying to make an AJAX call to the server.  The server is confused.

Attached may give you some ideas.  Not saying it's the best way, but it's an approach.

changed the action on your menu item.
added 5 lines of code to the PageHeaderTag procedure
added your ClearFile procedure to the Calls list for PageHeaderTag

and I changed ClearFile to use regular Open and Close statements, rather than file manager.  Emptying a file requires exclusive access.  In a real-world multi-user environment you'd need to do something more robust to make sure that any other people who had that file open were dealt with.

HTH,

Jane

mmelby

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: Calling Source procedure from Menu
« Reply #2 on: October 09, 2023, 06:52:43 AM »
Thank you! I will check it out.