PDA

View Full Version : Message for empty form items



new2extjs
27 Mar 2012, 4:06 AM
I have a form and I want to show a alert message if a user want to save or update an empty form items. I tried to access all the items and push them into an array and checked if any of them is null or undefined. But it is giving me errors when I delete the items because the null value of that deleted items still exists in the array. And I don't know how to specifically remove it coz it's position is not specific. Is there any better way to resolve this problem?



this.Array.push(this.query("[fieldLabel='Name']"));
this.Array.push(this.query("[fieldLabel='Address']"));
for (var k = 0; k < this.Array.length; k++) {
var fieldValue = this.Array[k];
for (var i = 0; i < fieldValue.length; i++) {


if (fieldValue[i].value === ' ' || fieldValue[i].value === null || fieldValue[i].value === 'undefined') {
Ext.Msg.alert('Please enter the require fields');
}
}


}

mitchellsimoens
27 Mar 2012, 10:41 AM
When you do a check you may want to set this.Array as an empty array.