NetTalk Central

Author Topic: Open a form on a specific tab  (Read 5161 times)

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Open a form on a specific tab
« on: July 24, 2012, 12:07:36 AM »
I have a form which has a number of tabs. Is there a way of opening the form and it automatically going to a particular tab?

Thanks

Ian

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Open a form on a specific tab
« Reply #1 on: July 24, 2012, 12:28:51 AM »
yes, but it's slightly different for different tab types. Are you using the "tabs" tab type? (not "wizard" etc?)

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Open a form on a specific tab
« Reply #2 on: July 24, 2012, 12:32:29 AM »
Yes I am using "Tab". I saw that when you hover over a tab it shows a hash anchor, eg. "'#tab_updateuser_self3_div'" where "3" is the 3rd tab, but I wasn't sure where to go from there to actually open the tabbed form on the 3rd tab?

Thanks

Ian

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Open a form on a specific tab
« Reply #3 on: July 24, 2012, 12:34:46 AM »
I should have said that I am opening the form direct from another form using
'change_btn=change&_bidv_=' & p_web.AddBrowseValue('pageheadertag','Users',USE:ById,p_web.GetSessionValue('LoginUserID'))

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Open a form on a specific tab
« Reply #4 on: July 24, 2012, 04:59:07 AM »
the tab to open is stored in the session value;
p_web.GSV('showtab_procedurename')
As I recall it is zero based (ie first tab = 0)

you can set this in your code, or perhaps set it based on a parameter (if the parameter exists.)

cheers
Bruce

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Open a form on a specific tab
« Reply #5 on: July 24, 2012, 05:09:04 AM »
Ok thanks. Where in the form procedure would you embed, for example,
p_web.SSV('showtab_procedurename',3), in order to open the form at tab 3? Obviously, the setting of the session variable would be conditional in some way.
« Last Edit: July 24, 2012, 05:12:33 AM by ianburgess »

ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Open a form on a specific tab
« Reply #6 on: July 24, 2012, 08:56:41 AM »
Ok I have found that I can embed in the "GenerateForm" embed point and get it to open a specific tab. My problem is now how to pass the tab number from the calling procedure.

I have tried setting a session variable "StartTab" when the button is pressed that launches the form, but I cannot find an embed point that is triggered when a button on a form is pressed? It seems that if you set the "On Click" to run a procedure, then the Server Side code is never run.

I could perhaps embed the "On click" called procedure in the Server Side code, but not sure what to embed - I am calling procedure UpdateUser_Self with a parameter of 'change_btn=change&_bidv_=' & p_web.AddBrowseValue('pageheadertag','Users',USE:ById,p_web.GetSessionValue('LoginUserID'))

... so that the form is opened from another form at the correct record.
« Last Edit: July 24, 2012, 01:03:21 PM by ianburgess »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Open a form on a specific tab
« Reply #7 on: July 24, 2012, 09:22:37 PM »
so you could add a parameter to the URL. for example;
tab=2&change_btn etc.

Then in the code;
if p_web.IfExistsValue('tab')
  p_web.SSV('showtab_procedurename',p_web.GetValue('tab'))
End


ianburgess

  • Full Member
  • ***
  • Posts: 119
    • View Profile
    • Email
Re: Open a form on a specific tab
« Reply #8 on: July 24, 2012, 09:51:53 PM »
Thanks Bruce. I was so intent on setting a session variable on the button press and reading it in the form that I overlooked the obvious!

I have done what you suggest and it works fine.