Normal Topic Set value as soon as an entry is made? (Read 416 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Set value as soon as an entry is made?
Sep 3rd, 2007 at 12:51pm
Print Post Print Post  
Right now I have an element, Creator, that is set to be filled with a global value as soon as a new, blank form is opened.  However, if I exit out of the form without making any other entries, the warning box "record has not been saved" pops up, which I do not desire, I'd like to make a clean exit unless I've made other entries.  So I want to take that programming out of on-form-entry.

Is there a way to have the element fill if the user makes any other kind of initial change to the form?  I know I can program on-form-change, but that will run whenever any element changes, every time an element changes.  I only need it to run once, when any element changes.

Is this possible?
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Set value as soon as an entry is made?
Reply #1 - Sep 3rd, 2007 at 1:59pm
Print Post Print Post  
You can put it in On Form Change and use a conditional like the following, to only execute if the Creator element is blank.

If @IsBlank(Creator) Then...
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Set value as soon as an entry is made?
Reply #2 - Sep 3rd, 2007 at 2:02pm
Print Post Print Post  
I usually do this using Form:: On Element Change with a Done flag.

GLOBAL CODE
------------------
Code
Select All
stat sDone as Int

   sDone = 0 




Form:: On Element Change
--------------------------------
Code
Select All
If @IsNew and sDone = 0
{
    // Do Stuff
    sDone = 1
} 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Set value as soon as an entry is made?
Reply #3 - Sep 3rd, 2007 at 3:19pm
Print Post Print Post  
Marvelous, thank you both.
  

**
Captain Infinity
Back to top
IP Logged