NetTalk Central

Author Topic: how to get parent page name in form page ?  (Read 6349 times)

kashiash

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Email
how to get parent page name in form page ?
« on: May 24, 2010, 09:02:12 AM »
i need to know parent name in form page
i try check vaulues on init form routine:
   p_web.GetSessionValue('_ParentProc')
   p_web.formsettings.parentpage
   p_web.GetValue('_ParentProc')

and every of above retur empty string  - why ?

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: how to get parent page name in form page ?
« Reply #1 on: May 24, 2010, 03:55:28 PM »
Try

p_web.GetValue('_ParentProc') early on in your code like pre-update, insert or start of procedure etc and if you get a value prime a session variable with the value
« Last Edit: May 24, 2010, 04:01:22 PM by kevin plummer »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: how to get parent page name in form page ?
« Reply #2 on: May 24, 2010, 09:54:27 PM »
The parent of a page is usually set for you and stored in loc:parent
so You can just use loc:parent in your code in _most_ embed points.

cheers
Bruce

kashiash

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Email
Re: how to get parent page name in form page ?
« Reply #3 on: May 24, 2010, 10:08:26 PM »
Bruce
as i see in source loc:parent is declared for browse procedure
for form this variable is not declared

To Kevin:
i copy code into pre insert and pre update embeds, but also get empty string ;(
« Last Edit: May 24, 2010, 10:47:07 PM by kashiash »

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: how to get parent page name in form page ?
« Reply #4 on: May 24, 2010, 11:35:11 PM »
The other option is just create your own Session Variable. I have one called 'ReturnURL' which I use for all sorts of things.

kashiash

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Email
Re: how to get parent page name in form page ?
« Reply #5 on: May 24, 2010, 11:41:17 PM »
Yes its a option but ...
 system know where should return after ok or cancel .. somewhere this information is stored and i want to get this value and use it. the extra variables and extra code make program more complicated nad less flexible

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: how to get parent page name in form page ?
« Reply #6 on: May 25, 2010, 12:56:21 AM »
Hi Jacek,

So, if I understand you right, what you really want to know is the URL that the Save / Cancel button will go to?
When (in what embeds) are you needing to use this item?
the URL for the save button is in loc:formaction, the URL for the cancel button is in loc:formactioncancel.


The "parent page" is typically used for a control embedded on a page - so it's not "where it came from" but rather the name of the container it's currently on.

Cheers
Bruce


kashiash

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Email
Re: how to get parent page name in form page ?
« Reply #7 on: May 25, 2010, 01:22:38 AM »
Unfortunatelly  you not understand me (its my bad english ;()
i open the same form from few other browses or forms
and in almost all cases i want to back to caller but in two cases i want to go to other then parent page.
here i can 2 ways:
1. in each procedure i set returnurl as sugested Kevin , but i have to modify each parent procedure
2 in called page i check who me call and if its specific parent then i change return page to new page (instead parent) - but here i need to know who is my parent

the second solution looks better for me but i cannot determine parent
here is my problem
any ideas?

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: how to get parent page name in form page ?
« Reply #8 on: May 26, 2010, 09:57:52 AM »
if i understand

Code: [Select]
  IF p_web.getPageName(p_web.RequestReferer)   = 'someform'   
     ! do magic stuff when you come this webpage

  END     
 

place near the the end of init.

kashiash

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Email
Re: how to get parent page name in form page ?
« Reply #9 on: May 26, 2010, 01:14:58 PM »
BINGO ;)
thanks a lot