PDA

View Full Version : help any one pls.....



rex0098
16 Nov 2009, 6:47 PM
its my first time using extjs.....

xtype : 'container', // 3
labelWidth : 30,
layout : 'form',
frame : true,
width : 150,
items :
[{
xtype : 'datefield', // 4
fieldLabel : 'Date',
//value: new Date(),
name : 'date',
anchor : '-20',
format : "M-d-Y",
readOnly:'true',
id:'initial',
listeners:{
'beforerender':function(){
var cur_date = new Date().format("M-d-Y");
var val_date = new Ext.getCmp("initial");
val_date.setValue(cur_date);

var mat_date = new Date().add(Date.DAY, 30).format("M-d-Y");
var val_mat_date = new Ext.getCmp("mature");
val_mat_date.setValue(mat_date);

var expiry_date = new Date().add(Date.DAY, 120).format("M-d-Y");
var val_ex_date = new Ext.getCmp("expire");
val_ex_date.setValue(expiry_date);

},
'select':function(){
var tryko = new Ext.getCmp("initial");
var md = new Date(tryko.getValue()).add(Date.DAY, 30).format("M-d-Y");
var mat = new Ext.get("mature").set({value:md });
var ed = new Date(tryko.getValue()).add(Date.DAY, 120).format("M-d-Y");
var ex = new Ext.get("expire").set({value: ed});
}
}
}]
},



this is a part the source code im using on my project...it gives my 3 date fields default values when the form loads then when i change the date on the first date field the other 2 fields will change its value also...it works perfectly in IE but when i tried running the code in firefox it also give the datefields value but when i change the date on the first date field the other 2 fields did not change its values......does anyone know what i did wrong?? i need your help please....and im sorry if my codes are not constructed very well...:(

rex0098
16 Nov 2009, 6:55 PM
oh i forgot to metion that i prefer using firefox as my browser so i was disappionted when my code didn't work on firefox. know that we can use extjs in almost or all of the current web browsers today so please help me....tanx in advance:)

hendricd
16 Nov 2009, 7:16 PM
@rex0098 -- (Please post your code with Forum
tags.)

What's all this new stuff ?

[CODE]
'beforerender':function(){
var cur_date = new Date().format("M-d-Y");
var val_date = new Ext.getCmp("initial");
val_date.setValue(cur_date);

var mat_date = new Date().add(Date.DAY, 30).format("M-d-Y");
var val_mat_date = new Ext.getCmp("mature");
val_mat_date.setValue(mat_date);

var expiry_date = new Date().add(Date.DAY, 120).format("M-d-Y");
var val_ex_date = new Ext.getCmp("expire");
val_ex_date.setValue(expiry_date);

},
'select':function(){
var tryko = new Ext.getCmp("initial");
var md = new Date(tryko.getValue()).add(Date.DAY, 30).format("M-d-Y");
var mat = new Ext.get("mature").set({value:md });
var ed = new Date(tryko.getValue()).add(Date.DAY, 120).format("M-d-Y");
var ex = new Ext.get("expire").set({value: ed});
}

rex0098
17 Nov 2009, 12:40 AM
oh sorry about that "new" stuff..i omitted it a while ago.. :D i already got it to function in firefox browser...thank god..hate my self not using my common sence...:D and i thanks for giving time reading my post...sorry if i disturbed you...maybe you could help me again some other time...:D because i'm new in ext there would be a lot of questions comming from me in the future....>:)

vargadanis
17 Nov 2009, 2:21 AM
There is nothing wrong with being new to ExtJS and making mistakes. I realized that folks here are willing to help us (newbs :) ). 1 suggestion tho... When you want to insert a code snippet on the forums, use the code block. This is going to help us read your code. I sometimes even use some sort of paste website with syntax highlighting.

Regards,
Daniel