View Full Version : [1.1] How to validate an editorgrid record using existing validaters

21 Aug 2007, 5:02 AM

i have an editorgrid and setup editors with validation.
I have als a button to add a record.

Now, how can i make sure, that the user keyed in valid input in the new record?

the CM:

var cm = new Ext.grid.ColumnModel([
{id: 'id', dataIndex: 'id', header: 'Id', width: 30},
{id: 'anrede', dataIndex: 'anrede', header: 'anrede', width: 60,
editor: new Ext.grid.GridEditor(
new Ext.form.TextField({
allowBlank: false

adding a new record:

function insertHandler(btn) {
new Ext.data.Record({
// mark this as a new record
id: -1,
anrede: '',
vorname: '',
nachname: '',
email: ''

I thought i coud use:

var record = grid.getSelectionModel().getSelected();
var hasErrors = record.hasErrors();

But hasErrors() only returns the internal error field, which does not seem to be set if the record was not touched by an edit action from the user.

Is there any method that can be called on the record object and that considers vtypes and allowblank requirements defined in the CM?