NetTalk Central

Author Topic: Conditional Tabs  (Read 2996 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Conditional Tabs
« on: October 10, 2012, 08:16:16 AM »
Bruce,

     I'm trying to conditionally display two tabs.  I have a Jobs database that allows applicants to create an account and then log on to view jobs.  Initially, applicants go to the main menu and select "Create Account".  I have the account form called without a browse (browseless form technique) by using 'Insert_btn=Insert' as the parameter to the menu call. 
     On this form I have numerous tabs, two of which I want to display conditionally.  One tab is labeled 'Create Password', the other is "Change Password'.  I want the create password tab to display when creating a new account, i.e. an Insert.  I want the change password tab to display when the user edits thier account info, i.e. a Change.
     So, on the Create Password tab, I placed the following in the Tab Condition field:

     p_web.formsettings.action = Net:InsertRecord

and on the Change Password tab, the condition is:

     p_web.formsettings.action = Net:ChangeRecord

     What I see is that the Change Password tab is displayed but not the Create Password tab.  This leads me to the conclusion that when I use the "browseless form" technique, the form actually opens in change mode.  Assuming that conclusion is correct, how can I accomplish this? 

Thanks,

Jeff King



kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Conditional Tabs
« Reply #1 on: October 10, 2012, 10:44:52 AM »
Bruce,

     I stumbled upon the local variable ans.  If I use ans = 1 (for Insert) and ans = 2 (for change) in the tab condition I get the results I'm looking for.  Could you educate me on the various variables such as:

ans, loc:formaction, loc:formactiontarget, loc:action, etc.?  How are they used, what values can they take, etc.?

Thanks,

Jeff



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Conditional Tabs
« Reply #2 on: October 11, 2012, 01:41:27 AM »
Hi Jeff,

The short answer to "what does each variable do" is "read the generated code" <g>.
The slightly longer answer is to check Appendix D and E of the "NetTalk Book".

with regard to your original question;

p_web.formsettings.action

may be set after your test. So I'd recommend using loc:Act instead.
Loc:Act is a Long, so in line with the Net:InsertRecord equates you are using. There's also a Loc:Action which contains a "string" form of the action. these are both set earl, so should be correct in all routines. (ie valid in any embed that's inside a routine.)

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Conditional Tabs
« Reply #3 on: October 11, 2012, 07:01:26 AM »
Bruce,

     Loc:Act was what I needed.  Thanks!