PDA

View Full Version : [SOLVED] Trouble with ComboBox controls



max969bl
5 Jun 2007, 5:42 AM
I'm creating a web form to input a little of data.

This is the code that mine JSP page generate:

[code]
<html>
<head>
<title>Selezione Parametri</title>
<link rel="stylesheet" type="text/css" href="/OA_HTML/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="/OA_HTML/ext/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="/OA_HTML/ext/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="/OA_HTML/ext/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="xxCvt_ParameterSelection.css" />
<script type="text/javascript">
var form;

Ext.form.HiddenField = function(config){
config.type = 'hidden';
config.inputType = 'hidden';
Ext.form.HiddenField.superclass.constructor.call(this, config);
};
Ext.extend(Ext.form.HiddenField, Ext.form.TextField, {
onRender : function(ct, position){
if(this.el){
this.el = Ext.get(this.el);
if(!this.target){
ct.dom.appendChild(this.el.dom);
}
}else {
var cfg = {tag: "input", type: "hidden"};
if(!cfg.name){
cfg.name = this.name || this.id;
}
this.el = ct.createChild(cfg, position);
}
this.el.dom.readOnly = true;
this.el.dom.parentNode.parentNode.style.display = 'none';
this.initValue();
}
});
Ext.namespace('Ext.atomodel');

Ext.atomodel.flagKWT = 0;
Ext.atomodel.elenco = [['238','WSAT-EE 82-282_R-407C - 142','123','1','0']];
Ext.atomodel.refr = [['1000','R-22_(010_1)'],['1002','R-407C_(010_3)']];
Ext.atomodel.r417 = [['2602','1 pompa_(417_1)'],['2603','2 pompe_(417_2)']];
Ext.atomodel.gly =
[
['0', 'Brine disabilitato'],
['5', '5%'],
['10', '10%'],
['15', '15%'],
['20', '20%'],
['25', '25%'],
['30', '30%'],
['35', '35%'],
['40', '40%'],
['45', '45%'],
['50', '50%']
];

Ext.onReady(function(){

Ext.QuickTips.init();

// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';

form = new Ext.form.Form({
labelAlign: 'top',
labelWidth: 460,
method: 'POST',
url: 'xxCvt_doParameterSelection.jsp',
baseParams: {oehd: '266448', oeln: '583046'}
});

form.fieldset(
{labelSeparator: '', legend:'Dati Progetto'},
new Ext.form.ComboBox({
name: 'nomeModello',
allowBlank: false,
fieldLabel: 'Progetto',
store: new Ext.data.SimpleStore({
fields: ['cpro', 'desc', 'cgra', 'ccnf', 'kwt'],
data : Ext.atomodel.elenco
}),
editable: false,
displayField:'desc',
valueField: 'cpro',
typeAhead: true,
typeAheadDelay: 100,
mode: 'local',
triggerAction: 'all',
emptyText:'Selezionate un progetto...',
selectOnFocus:true,
value: (Ext.atomodel.elenco.length==1?Ext.atomodel.elenco[0][0]:'238'),
onSelect: function (record) {
var params = '?oehd=266448&oeln=583046';
params += '&cpro='+record.get("cpro");
params += '&cgra='+record.get("cgra");
params += '&ccnf='+record.get("ccnf");
params += '&kwt='+record.get("kwt");
params += '&modello=AA2N25';
window.location = '/OA_HTML/xxCvt_ParameterSelection.jsp'+params;
}
}),

new Ext.form.HiddenField({
name: 'modello', value: 'AA2N25'
}),

new Ext.form.HiddenField({
name: 'ccnf', value:'1'
}),

new Ext.form.HiddenField({
name: 'cgra', value:'123'
}),

new Ext.form.HiddenField({
name: 'cpro', value: '238'
}),

new Ext.form.ComboBox({
name: 'refrigerante',
allowBlank: false,
fieldLabel: 'Refrigerante',
store: new Ext.data.SimpleStore({
fields: ['item_id', 'ref_part_nbr'],
data : Ext.atomodel.refr
}),
editable: false,
displayField:'ref_part_nbr',
valueField: 'item_id',
typeAhead: true,
typeAheadDelay: 100,
mode: 'local',
emptyText:'Selezionate un refrigerante...',
selectOnFocus:true,
value: (Ext.atomodel.refr.length==1?Ext.atomodel.refr[0][0]:Ext.atomodel.refr[0][0]),
onSelect: function (record) {
form.findField('cref').setValue(record.get("item_id"));
form.findField('ref').setValue(record.get("ref_part_nbr"));
}
}),






new Ext.form.ComboBox({
name: 'r417',
allowBlank: false,
fieldLabel: 'Numero Pompe (Gruppi Pompaggio)',
store: new Ext.data.SimpleStore({
fields: ['item_id', 'ref_part_nbr'],
data : Ext.atomodel.r417
}),
editable: false,
displayField:'ref_part_nbr',
valueField: 'item_id',
typeAhead: true,
typeAheadDelay: 100,
mode: 'local',
triggerAction: 'all',
emptyText:'Selezionate una risposta...',
selectOnFocus:true,
value: Ext.atomodel.r417[0][0],
onSelect: function (record) {
form.findField('c417').setValue(record.get("ref_part_nbr"));
}
}),

new Ext.form.HiddenField({
name: 'c417',
value: Ext.atomodel.r417[0][0]
}),




new Ext.form.HiddenField({
name: 'cref',
value: (Ext.atomodel.refr.length==1?Ext.atomodel.refr[0][0]:Ext.atomodel.refr[0][0])
}),

new Ext.form.HiddenField({
name: 'ref',
value: (Ext.atomodel.refr.length==1?Ext.atomodel.refr[0][1]:Ext.atomodel.refr[0][1])
})
);

form.fieldset(
{labelSeparator: '', legend:'Condizioni di Funzionamento (Cooling)'},

new Ext.form.ComboBox({
name: 'glicole',
hiddenName: 'glicole',
allowBlank: false,
fieldLabel: 'Glicole',
store: new Ext.data.SimpleStore({
fields: ['valore', 'descr'],
data : Ext.atomodel.gly
}),
displayField:'descr',
valueField: 'valore',
typeAhead: true,
typeAheadDelay: 100,
mode: 'local',
triggerAction: 'all',
emptyText:'Selezionate una percentuale...',
selectOnFocus:true,
value: '0'
}),

new Ext.form.NumberField({
allowBlank: false,
selectOnFocus: true,
name: 'INPUT1',
fieldLabel: 'aria ingresso scambiatore esterno (

tryanDLS
5 Jun 2007, 7:16 AM
Why are you overriding the private onSelect method in your code? Events are provided to do extra handling on select - you have bypassed the base code for combo in this case.

max969bl
5 Jun 2007, 7:26 AM
Why are you overriding the private onSelect method in your code? Events are provided to do extra handling on select - you have bypassed the base code for combo in this case.

:D I was just realizing that i was overriding the base code of the combo and i solved the trouble 1 minutes ago.

In any case thanks for your fast answer ;)