CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Auto-Save Changes to Record

Print topic Send  topic

Author Message
maxhugen

Posts: 272
Posted: 04/03/2008, 4:21 PM

While testing a Master/Detail page, I made some changes to a Record, but then selected another record from the master list (Grid), and lost my changes as I'd forgotten to Submit.

My fault, due to many years of using MS Access, which auto-saves records transparently.

Is there a method that anyone can suggest, to either Auto-Save a record, or warn a user, if changes have been made to a record without Submitting, before allowing the app to go to the next selected record?
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
ckroon

Posts: 869
Posted: 04/25/2008, 7:48 AM

I would love to be able to do this as well... anyone?
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
maxhugen

Posts: 272
Posted: 04/25/2008, 5:04 PM

1. Add a hidden field 'Modified' (or a graphic as I have done) to the form, with id="Modified".

2. For each editable field in the form, add a Client side (ie, Javascript) OnChange event. In this event call a function 'SetModified'.

3. For the Insert and Update buttons, add an OnClick event that calls function 'ClearModified'.

4. In the Links in the Master Grid, add onclick="CheckModified()".

In this example, I have used a small "Edited" graphic that becomes visible once the user has changed any field: <img id="Modified" style="VISIBILITY: hidden" alt="Record Modified" src="img/modified.gif">

If you use a hidden field instead, just set it's value to Yes or True, and change the following code appropriately.

function SetModified() {  
        document.getElementById("Modified").style.visibility="visible";  
}  
function ClearModified() {  
        document.getElementById("Modified").style.visibility="hidden";  
}  
function CheckModified() {  
        if (document.getElementById("Modified").style.visibility == "visible") {  
                if (confirm("The record has been modified. Save it?")) {  
                        document.getElementById("ClientDetail").submit();  
                }  
        }  
}

_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
ckroon

Posts: 869
Posted: 04/27/2008, 9:59 PM

Awesome!
Thanks!
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.