PDA

View Full Version : Form loaded using JSON is always dirty?



LeonM
11 Jan 2011, 6:56 AM
When using a formPanel, that is loaded using:



loadForm = function(){
myForm.load({
url: './api/GetUserInfo.php' //returns JSON string
});
Where the form uses a JSONReader tot parse the data, all fields seem to be marked "dirty", with an initial value of "".



myForm.getForm().findField('EmailAddress').isDirty(); //Always true
How do I prevent this from happening? Should I load the form before render? Or should I somehow mark the fields as unmodified (clean?) after loading? Or am I doing something else wrong here?

I want to be able to warn a user upon submit when he/she changed his/her email address, since this is also their login name.

Condor
11 Jan 2011, 7:03 AM
You want trackResetOnLoad:true.

LeonM
11 Jan 2011, 8:14 AM
Thanks Connor, that is exactly what I needed! Works like a charm