Normal Topic using Goto (Read 965 times)
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
using Goto
Mar 3rd, 2004 at 7:34pm
Print Post Print Post  
What difference does it make whether I do error checking in On Element Change or On Element Exit?

I have a LE named FirstName and this is the code:

if @Len(@Num(FirstName)) > 0 and FirstName <> "" then
{

@MsgBox("Error: First Name cannot contain digits.","","")
goto FirstName
}

If I put this code inside On Element Change and I enter a first name with digits in it, I receive the error message 3 times repeatedly and then I return to the FirstName LE. However, if I put the code inside On Element Exit, I get the error message once and then I arrive in another LE (named LastName). 

What gets weirder is that if i change "goto FirstName" to "goto Company" in Element Exit, where Company is another LE, I will arrive in the correct LE?

Why am I receiving 3 error messages w/ On Element Change when the value of the LE has not changed after I get the first error message?

Thanx
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: using Goto
Reply #1 - Mar 3rd, 2004 at 9:11pm
Print Post Print Post  
I got the same results you are getting. I believe this has to do with the bug in goto the same element, that has been fixed in ver 1.0.2. If you remove the goto the same element statement, you will get the error message only once. I am wondering, why would you put the statement in Element Change event? You are not getting the message until you exit the element anyway. Sometimes putting such statement in Immediate Element Change Event because you want to have feedback before you exit the element as it is used in the phone template snippet by Mark in the programming examples. In most of the other cases it goes in the Element exit events.
  
Back to top
 
IP Logged
 
dman
Member
*
Offline


A Complete Dummy

Posts: 19
Joined: Feb 18th, 2004
Re: using Goto
Reply #2 - Mar 4th, 2004 at 12:27am
Print Post Print Post  
OK I have a goto question and I'm sure it's a dumb goto question but I am trying to learn. If I put a goto command in the form / on form entry (Exactly like the goto CU# in the quickanswer this month), it doesn't work at all. It still goes to the uppermost element. If I put it in the form/ on element entry, it works. Did I read it wrong and therefore am trying to do it wrong?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: using Goto
Reply #3 - Mar 4th, 2004 at 1:43am
Print Post Print Post  
It is a good observation. I could duplicate what you have detected. There are several events and we do not exactly know what is the programming you have in each event. Moreover, we do not know with certainty that which event fires first out of these two... namely in form element entry or Form Entry.... my guess is form entry fires first and then Form element entry. Bob Hansen questioned not too long ago about the sequence of events but I do not think anybody is quite clear yet. And on the top of all these, we have some well established problems with goto command, namely goto the same element would not work, goto in Global Code does not work and now goto in Form Element on Form entry event does not work.  Well, atleast we know what works in this instance.  Smiley
« Last Edit: Mar 4th, 2004 at 9:37am by Bharat_Naik »  
Back to top
 
IP Logged
 
dman
Member
*
Offline


A Complete Dummy

Posts: 19
Joined: Feb 18th, 2004
Re: using Goto
Reply #4 - Mar 4th, 2004 at 2:02am
Print Post Print Post  
Maybe that's why he said we need version 1.0.2? Smiley
  
Back to top
 
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: using Goto
Reply #5 - Mar 5th, 2004 at 9:44pm
Print Post Print Post  
Well ehre is my view on how event processing probably works (based on past programming experience).

When you first load up the form it launches the form entry event. When you then open up a record in the form it should then fire the element entry event. The on element change should fire when you try to switch LE's or if its form change - when you change from form to subform? (not sure on this one) or to another form, Immediate element change would fire every time something changes in the LE (ie if you were to type abc it would fire the event 3 times). When you switch to another record or exit the form it then Fires the Element exit and finally when exiting the form at the very end it fires the Form exit.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: using Goto
Reply #6 - Mar 6th, 2004 at 5:29am
Print Post Print Post  
Hello Justin_ICC...

Take a look at the discussions on this topic at: http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
especially the details by Bharat_Naik on Feb 22.   Still hoping for an "official" summary to work with.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged