PDA

View Full Version : simple form validation / tooltip help



yattias
22 Nov 2009, 8:37 PM
Hi all, I am new to EXT JS and I love it. I have a pretty basic question regarding form validation and tooltips. I need to display a tooltip error when form fields are not blank and I can't figure out how to.

Here is my code:


<script type="text/javascript">
Ext.onReady(function () {

Ext.QuickTips.init();
var form_add_product = new Ext.FormPanel(
{
renderTo: document.body,
frame: true,
url: 'form1.htm',
title: 'Add Product Form',
name: 'formAddProduct',
width: 600,
method: 'GET',
items: [{
xtype: 'textfield',
inputType: 'file',
fieldLabel: 'Products File',
name: 'txtProductsPagePath',
allowBlank: 'false'
},{
xtype: 'textfield',
fieldLabel: 'Product Name',
name: 'txtProdName',
allowBlank: 'false'
},{
xtype: 'textfield',
fieldLabel: 'Product ID',
name: 'txtProdId',
anchor: '100%',
allowBlank: 'true'
},{
xtype: 'textfield',
fieldLabel: 'SKU',
name: 'txtProdSku',
anchor: '100%',
allowBlank: 'false'
},{
xtype: 'textfield',
fieldLabel: 'Price',
name: 'txtProdPrice',
anchor: '100%',
allowBlank: 'true'
},{
xtype: 'textfield',
fieldLabel: 'MSRP',
name: 'txtProdMsrp',
anchor: '100%',
allowBlank: 'true'
},{
xtype: 'textfield',
fieldLabel: 'Product Page Link',
name: 'txtProdPageLink',
anchor: '100%',
allowBlank: 'true'
},{
xtype: 'textarea',
fieldLabel: 'Description',
name: 'txtAreaProdDesc',
height: 100,
width: 400,
anchor: '100%',
allowBlank: 'true'
}],
submit: function() {
this.getEl().dom.submit();
},
buttons: [{
text: 'Submit',
handler: function () {
form_add_product.getForm().submit();
}
}]
});

});
</script>
shouldn't allowBlank: 'false' automatically display a tooltip error?/:) Thanks for the help!

yattias
23 Nov 2009, 6:46 AM
I got it...I put the values of allowBlank in quotes. Duh.