NetTalk Central

Author Topic: SetValue StoreValue  (Read 3121 times)

rayrip

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Email
SetValue StoreValue
« on: April 27, 2021, 04:14:33 PM »
I just want to make sure I've got this right and won't cause problems. In the Webhandler for checking the password I've got that working and want to set levels so I did this if the password is good...

if pPassword=PAS:PASSWORD
    ReturnValue = true
    self.SetSessionLevel(PAS:PASS_LEVEL)
    p_web.SetValue('CustomerBrowseLevel','5')
    p_web.StoreValue('CustomerBrowseLevel')
    p_web.SetValue('CustomerEditLevel','7')
    p_web.StoreValue('CustomerEditLevel')

I am using p_web.GSV('CustomerEditLevel') in the security area of my form and it seems to be working. I saw a post where you said that SetValue is rarely used.. but that is the only way I could get my session values to work.


Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: SetValue StoreValue
« Reply #1 on: April 27, 2021, 06:06:40 PM »
Ray,

What happens if instead you use:

if pPassword=PAS:PASSWORD
    ReturnValue = true
    self.SetSessionLevel(PAS:PASS_LEVEL)
    self.SetSessionValue('CustomerBrowseLevel','5')
    self.SetSessionValue('CustomerEditLevel','7')

I think you were complicating it your way.
You were first doing a SetValue, which sets a parameter value that only lives for the duration of the incoming request.
And then you turn around and do a StoreValue that moves the parameter into Session data.
Instead of simply setting the Session Value directly.

Jane


rayrip

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Email
Re: SetValue StoreValue
« Reply #2 on: April 28, 2021, 11:02:26 AM »
Thanks Jane, that worked perfectly. I must have been doing something wrong before.. I tried that originally but I probably had the syntax or the parameters wrong.