1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
var codePostal = new Ext.form.ComboBox({
fieldLabel:'<b>Code Postal</b>'
,name: 'adresseCodePostal'
,hiddenName: 'adresseCodePostal'
,displayField:'ville_cp'
,valueField:'ville_cp'
,store:new Ext.data.SimpleStore({
fields:['ville_cp']
,data:Ext.exampledata.codePostal
})
,triggerAction:'all'
,mode:'local'
,lastQuery:''
,listeners:{
'keyup' : function(c, evt){
if(this.getValue().length > 5){
this.setValue(this.getValue().substring(0, 5));
}
},
select:{fn:function(combo, value) {
var comboCity = Ext.getCmp('combo-city');
comboCity.clearValue();
comboCity.store.filter('ville_cp', combo.getValue());
}}
}
,labelSeparator: '<b>:</b>'
,xtype:'combo'
,editable:true
,width: 200
,allowBlank:false
,value: '<%=u.getAdresse().getCodePostal() %>'
,blankText: 'Votre code postal est obligatoire'
,emptyText:'Choisir votre Code Postal'
,style: 'border: 0px;'
});
var adressVille = new Ext.form.ComboBox({
fieldLabel:'<b>Ville</b>'
,displayField:'ville_nom'
,name: 'adresseVille'
,valueField:'ville_id'
,id:'combo-city'
,store:new Ext.data.SimpleStore({
fields:['ville_id', 'ville_nom', 'ville_cp', 'ville_dept']
,data:Ext.exampledata.city
})
,triggerAction:'all'
,mode:'local'
,lastQuery:''
,labelSeparator: '<b>:</b>'
,xtype:'combo'
,regex: codePostalExpr
,regexText: 'Format attendu : 5 chiffres'
,editable:false
,width: 200
,allowBlank:false
,blankText: 'Votre ville est obligatoire'
,emptyText:'Choisir votre ville'
,style: 'border: 0px;'
,value: '<%=StringEscapeUtils.escapeJavaScript(u.getAdresse().getVille())%>'
}); |
Partager