PDA

View Full Version : monitorValid and formBind don't work



dranix
21 Oct 2011, 2:50 AM
Hello everyone
I'm new to Ext Js, especially its grid, and it is wonderful library.
Today I have a problem, I have search and read many posts but I don't know why I don't work
I have a grid, and I use pop up add/edit
When the add form popup, I use monitorValid and formBind but the Save button is still enable
Would some one please help me?

var BookItem = new Ext.FormPanel({
border: false,
frame: true,
labelWidth: 70,
monitorValid: 'true', // !Important
items: [
{
xtype: 'textfield',
name: 'id',
id: 'id',
hidden: true
},
{
xtype: 'textfield',
name: 'book_title',
id: 'book_title',
width: 100,
fieldLabel: 'Book Title',
allowBlank: false
},
{
xtype: 'textfield',
name: 'author',
id: 'author',
width: 100,
fieldLabel: 'Author'
}],
buttonAlign: 'center',
buttons:
[{
align: 'center',
text: 'Save',
handler: Add,
formBind: 'true' // !Important
}, {
align: 'center',
text: 'Cancel',
handler: Cancel
}]
});



var winForm = new Ext.Window({
title: formTitle,
modal: true,
width: 275,
autoScroll: true,
bodyStyle: 'position:relative;',
monitorResize: true,
constrain: true,
layout: 'fit',
height: ht,
closeAction: 'hide',
layout: 'fit',
items: BookItem
});


var CreateBookItem = function () {
winForm.update = true;
winForm.setTitle('Create' + " " + formTitle);
BookItem.getForm().reset();
winForm.show();
if (winForm.getHeight() < ht) {
winForm.setHeight(winForm.getHeight() + 32);
}
winForm.center();
};

Any help is highly appreciated
Thank in advance

raj_plays
21 Oct 2011, 2:55 AM
monitorValid and formBind take boolean values.
Assign true instead of 'true' to them.

dranix
21 Oct 2011, 3:02 AM
I don't know what to say :( (stupid me)
Thank you very much