NetTalk Central

Author Topic: Why does code fire twice?  (Read 3141 times)

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Why does code fire twice?
« on: December 04, 2011, 05:11:17 AM »
In ONE field only on my form I have some Reset Code:

LOC:ClientString = p_web.restorevalue('Cli:FirstName') & p_web.restorevalue('Cli:LastName')

However when I check, this code is firing twice when I press TAB on that field.

I have placed my code in Routines, General Tab, Field Name - 3 Value Routine - Actually just read the manual again and think this should go in 2 Valiudate:Server Side - but still the same - fires twice

Is there a different embed to use to only make it fire once?

Also why does it only fire on Insert? Is there somewhere I have missed to make it fire on Edit also?

John
« Last Edit: December 04, 2011, 01:54:51 PM by ambrit »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Why does code fire twice?
« Reply #1 on: December 05, 2011, 12:10:54 AM »
the "calling twice" issue is fixed in the 6.07 build.

your code though should be;

LOC:ClientString = p_web.GSV('Cli:FirstName') & ' ' & p_web.GSV('Cli:LastName')
p_web.SSV('LOC:ClientString',LOC:ClientString)

GSV is short for GetSessionValue, SSV is short for SetSessionValue.

In the "server side code" you should always set the SessionValue.

The exact location of the code will determine when it runs. What routine is it in?

cheers
Bruce

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Re: Why does code fire twice?
« Reply #2 on: December 05, 2011, 12:22:20 AM »
Thanks Bruce.

My code is in Routines, General Tab, Field Name - 2 Valuidate FiledName - Add Server Side Code

John

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Why does code fire twice?
« Reply #3 on: December 05, 2011, 07:04:55 AM »
that's what I assumed - so that's goo. Note that that runs when the field is completed, but not when the user clicks on "Save".