NetTalk Central

Author Topic: Return to referring page after server code executes on custom button  (Read 4143 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Hi,

I have a custom button on a form that executes code on the server.  I would like to return to the referring page after the code executes.  The NetTalk template let me return to the referring page for the button, but it bypasses the server code I need.     Is there a NetTalk method for doing this (couldn't see one),  and where should it be called from?

Thank you. 

mpetitjean

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Nola Ridge
    • Email
Re: Return to referring page after server code executes on custom button
« Reply #1 on: November 14, 2007, 05:26:58 AM »
     What are you changing on the server side?  Can this be done with variables passed in the URL?

     Generally we use the URL prompt on the button's properties tab, to send something like calledwebpage&SomeVariable=2&AnotherVariable=Great.  Then at the beginning of the recalled page (in source) we use p_web.GetValue('SomeVariable') and p_web.GetValue('AnotherVariable') to set these to either session values (if we need them to persist) or local variables if they only need to change the page returned.  Set the target control to '_self' if you want the page to refresh in the same frame on the page.

    Hope this helps!

Mike Petitjean
Lodi Computer Services, Inc.

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Return to referring page after server code executes on custom button
« Reply #2 on: November 15, 2007, 11:55:51 AM »
Thanks for the suggestion, Mike.

I don't think that is going to work all that well for me, principally because the referrer page can be one of several page procedures.

Much appreciated, though.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: Return to referring page after server code executes on custom button
« Reply #3 on: November 16, 2007, 04:57:12 AM »
Hi Casey,

Is your button a "button" or a submit.

As I understand it what you're really wanting to do is "refresh this page" once the server side code has completed?

Cheers
Bruce


CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Return to referring page after server code executes on custom button
« Reply #4 on: November 20, 2007, 06:44:20 PM »
hi, Bruce

Sorry for the delay.  It is a 'button'.  I did a small conditional javascript that will return to the referrer, but couldn't find a place in the embeds or NetTalk templates where it would get written only when it was required.

I have been working with Mike's suggestion doing the server execution based on values passed to the referrer.   That works but requires a template and embed on each of the several referrers.  Not a big problem, but not very elegant.  A more significant issue is that the record values attached to the button URL do no clear if the form is called with a different record.  The new record's values are simply added to the old values on the URL.

Happy with either approach.   Thanks.
 

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Return to referring page after server code executes on custom button
« Reply #5 on: November 29, 2007, 02:10:34 PM »
For the sake of anyone following this thread,  Mike Petitjean's solution of calling the referer with parameters did prove to be most workable.   Because the referer could be one of several procedures, I used templates to standardize the processing.  Since the user might do the same process several times in a row,  the referer URL kept getting longer with the new parameter values simply appended to the previous ones.  I got around that by using a local variable as the site/page part of the button URL.  I simply clipped the parameters from p_web.requestreferer for the local variable at the start of the GenerateForm routine.