NetTalk Central

Author Topic: Memory of drop fields  (Read 3136 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Memory of drop fields
« on: June 01, 2010, 02:01:12 PM »
Hi,
I have a form with some drops that filters a browse.
All the drop variables are set the same way.
All fields has the "Send new value to server" checked.
Some of the drop variables are Primed with the "Only if field has not already set" check on.
Those fields does no remember its value from page to page, they are allways seted to the prime value.

As an example, this is the code the template is adding for one of these fields:

  If p_web.IfExistsValue('loc:Estado')
    loc:Estado = p_web.GetSessionValue('loc:Estado')
  else
    loc:Estado = 'OTM'
    p_web.SetSessionValue('loc:Estado',loc:Estado)
  end

Adding some debug, I realized that
.IfExists returns allways a 0 while the gsv return 'ITM'

Is this a bug?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Memory of drop fields
« Reply #1 on: June 02, 2010, 12:27:26 AM »
Hi Alberto,

without having tried your code in an example, the probable problem is the mix of IfExistsValue with GetSessionValue.
I'm thinking you probably want to test for IfExistsSessionValue, or alternatively make use of GetValue if the Value exists.

Remember that Values are fleeting, and only exist for the life of the actual call. This means they are usually not there in a dynamic-update, such as a form field update, or a browse page update. Session Values are therefore the preferable item to use - as you have don. I think just your IfExistsValue should be an IfExistsSessionValue.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Memory of drop fields
« Reply #2 on: June 02, 2010, 02:01:01 AM »
Bruce,
This is not my code!
This is the code the template generates in the PreUpdate, PreInsert, etc to prime the variables defined in the Prime Tab.
May be, in the case of memory forms, te template may add a

  If p_web.IfExistsValue('loc:Estado') or p_web.IfExistsSessionValue('loc:Estado')
    loc:Estado = p_web.GetSessionValue('loc:Estado')
  else
    loc:Estado = 'OTM'
    p_web.SetSessionValue('loc:Estado',loc:Estado)
  end

or add a new check to the prime tab to define if the variable will be sessioned.
Mean time I will hand code it.

Thanks
Alberto
-----------
Regards
Alberto