Normal Topic Prevent Saving a Blank Record (Read 1009 times)
PianoMan
Member
Members
*
Offline


No personal text

Posts: 44
Joined: Oct 13th, 2004
Prevent Saving a Blank Record
May 8th, 2013 at 4:06pm
Print Post Print Post  
Using the sample Customers database, I can advance to a new record in extended mode (Update Mode), enter data in an element, then tab out. I can then go back to that element and delete the entry, press F10, and save a blank record. To prevent this, calling NotifyForm(1) isn't a solution, because then I can't retreat (F9) to the last saved record in the Result Set. Is there a way I can prevent saving a blank record, yet still retreat to a previous record?
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Prevent Saving a Blank Record
Reply #1 - May 8th, 2013 at 7:14pm
Print Post Print Post  
I'll look into changing that behavior.

In the meantime, you might want to look at:

NOTIFY_FORM_ADVANCE_DISABLED
NOTIFY_FORM_CHANGE_FLAG_DISABLED

while also setting:

NOTIFY_FORM_RETREAT ENABLED

some combination of these might get you what you want - a retreat without a commit.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Prevent Saving a Blank Record
Reply #2 - May 8th, 2013 at 8:56pm
Print Post Print Post  
Ok. I see what is happening and it is somewhat limited to Customers.db. The check box "Active" element is defaulting to a "NULL" state if the record has never been viewed. But, once viewed it gets initialized - and the engine believes that that is a change of value, so the record is not blank.

Once I deleted the check box element, retreating from a changed but now all blank record, works as it should: retreats but does not commit.

So - basically, this bug seems be limited to forms with check boxes. Though, there may be other element types (not on the Customers form) that exhibit similar behavior.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
PianoMan
Member
Members
*
Offline


No personal text

Posts: 44
Joined: Oct 13th, 2004
Re: Prevent Saving a Blank Record
Reply #3 - May 8th, 2013 at 9:19pm
Print Post Print Post  
Hi Mark,
You may be right that this is limited to check boxes. I ran a quick test by first deleting the check box, then adding tab pages, image box, command button, radio buttons, combo box, and a static image box. With these additional elements, retreating does not save a blank.
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Prevent Saving a Blank Record
Reply #4 - May 8th, 2013 at 9:59pm
Print Post Print Post  
Yah. I'll look into checkboxes to see what makes them so special.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Prevent Saving a Blank Record
Reply #5 - May 9th, 2013 at 1:31pm
Print Post Print Post  
Found and fixed.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
PianoMan
Member
Members
*
Offline


No personal text

Posts: 44
Joined: Oct 13th, 2004
Re: Prevent Saving a Blank Record
Reply #6 - May 10th, 2013 at 5:11pm
Print Post Print Post  
Very cool. Thanks Mark.
  
Back to top
IP Logged