PDA

View Full Version : Need help with checking fields



benmaya
26 Aug 2011, 4:14 AM
Hello,

I have a desktop application that opens a GridPanel window.
On this window I have a button 'add' that opens another window with form


MyDesktop.GiftWindow.addTransWindow = new Ext.Window({
id:'addTransWindow',
title: 'Redeem Gift Card',
width:350,
height:250,
modal:true,
autoScroll : true,
bodyStyle:'background-color:white; padding: 5; spacing: 5;',
items:{
layout:'form',
border:false,
items:[{
xtype: 'textfield',
fieldLabel: 'Gift Card Number',
id: 'card_number',
anchor:'90%'
},
{
xtype: 'datefield',
fieldLabel: 'Date',
id: 'gift_date',
format:'Y-m-d', value: (new Date()).format('Y-m-d'), readOnly:true
},
{
xtype: 'textfield',
fieldLabel: 'Points',
id: 'card_value',
anchor:'90%'
},
{
xtype: 'textfield',
fieldLabel: 'Description',
id: 'card_desc',
anchor:'90%'
}

]
},
buttons:[{
text:'Add', id: 'btnAdd',
handler: function(){
}

now what I want to do is that when a user insert text into one of the fields it opens on the same window an hidden div that displays the content of a php file according to what the user has put.

Is this possible?
thanks!

bkraut
26 Aug 2011, 6:27 AM
Yes it is possible. Configure onKeyUp or similar event on TextField and then set html property of the panel (div) that you would like to display your content.

benmaya
26 Aug 2011, 6:40 AM
thank you for your answer
But where do I setup the div on the on the opened window?

benmaya
26 Aug 2011, 7:42 AM
ok I managed to get the keyup works now I try to put back the response into one of the fields (points)
I try this:



var chk_card = function(response,opt){
var json = response.responseText;
var op = Ext.decode(json);
Ext.MessageBox.hide();
Ext.getCmp('points').value = op.Result ;
};

it doesn't work... any idea why?

bkraut
28 Aug 2011, 5:56 AM
When you define Ext.Panel there is html attribute. If you set it you set the content of the Panel. Panel is div.