PDA

View Full Version : [CLOSED]Error and Firebug



MarcoF
05-31-2010, 04:01 AM
Hallo, this is my first attempt to code something, I made a very simple form with 3 combo and a numeric field. When I try to execute the program I can see only the HTML part but the Js is giving an error (b is null) pointing to line 7 in ext-all.js. Line #7 is a very long line of code and I don't know how to spot the error. Any hint?

TIA
MarcoF


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright 2010-2010 Mr S.r.l. Unipersonale, All Rights Reserved">
<title>Interfaccia per calcolo indici IT</title>
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/vvresources/valence.css" />
<script type="text/javascript" src="/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/extjs/ext-all.js"></script>
<script type="text/javascript" src="/vvresources/valence.js"></script>
<script type="text/javascript">

Ext.onReady(function() {

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

// the following function will call an RPG program when user clicks "Calcola" or presses the ENTER key
var getCalcolo = function() {
Ext.Ajax.request({
url: 'vvcall.pgm',
params: {
pgm: 'OFCALIND',
action: 'getCalcolo',
comboIndice: Ext.getCmp('comboIndice').getValue(),
comboAnno: Ext.getCmp('comboAnno').getValue(),
comboMeseIniziale: Ext.getCmp('comboMeseIniziale').getValue(),
NumeroMesi: Ext.getCmp('NumeroMesi').getValue()
},
success: function(response) {
var check = response.responseText;
if (check) {
var data = Ext.util.JSON.decode(response.responseText);
if (data.SUCCESS == '1') {
// focus the cursor on the customer number field
Ext.getCmp('comboIndice').focus();
} else {
// Segnala il numero di mesi perchè eccessivo
var f = Ext.getCmp('NumeroMesi');
f.markInvalid(data.MSGTEXT);
// focus the cursor on the field
f.focus();
};
};
}
});
};
var formMain = new Ext.FormPanel({
title: 'Calcolo indici IT',
iconCls:'application_view_detail',
frame: true,
header: true,
labelAlign: 'right',
labelWidth: 110,
width: 450,
items:[{
xtype:'combo',
fieldLabel:'Seleziona l"indice da calcolare',
labelSeparator:' ',
id:'comboIndice',
triggerAction:'all',
forceSelection:true,
valueField: 'VVVALUE',
displayField:'VVREC',
store: new Ext.data.JsonStore({
autoLoad:true,
url:'vvcall.pgm',
baseParams:{
pgm:'OFCALIND',
action:'getIndici'
},
root:'VVGENDS1',
fields:['VVVALUE','VVREC']
})
},{
xtype:'combo',
id:'comboAnno',
fieldLabel:'Scegli l"anno da calcolare',
labelSeparator:' ',
valueField: 'VVVALUE',
displayField:'VVREC',
triggerAction:'all',
style:{
marginLeft: '10px'
},
store: new Ext.data.JsonStore({
autoLoad:true,
url:'vvcall.pgm',
baseParams:{
pgm:'OFCALIND',
action:'getAnni'
},
root:'VVGENDS1',
fields:['VVVALUE','VVREC']
})
},{
xtype:'combo',
id:'comboMeseIniziale',
fieldLabel:'Scegli il mese da cui partire',
labelSeparator:' ',
valueField: 'VVVALUE',
displayField:'VVREC',
triggerAction:'all',
style:{
marginLeft: '10px'
},
store: new Ext.data.JsonStore({
autoLoad:true,
url:'vvcall.pgm',
baseParams:{
pgm:'OFCALIND',
action:'getMesi'
},
root:'VVGENDS1',
fields:['VVVALUE','VVREC']
})
},{
xtype: 'numberfield',
id: 'NumeroMesi',
fieldLabel: 'Numero mesi da calcolare',
width: 200,
selectOnFocus: true,
autoCreate: {
tag: 'input',
maxlength: '2'
}
}],
buttons: [{
text: 'Calcola',
id: 'buttonCalcola',
iconCls: 'accept',
handler: getCalcolo
}],
keys: [{
key: Ext.EventObject.ENTER,
fn: getCalcolo
}]
});

formMain.render('formMain');

// when main panel is first rendered, set a listener for the customer to be entered and focus the cursor on the customer number field
f = Ext.getCmp('NumeroMesi');
f.focus();
});
</script>

</head>
<body>
<table border="0" style="font-family:helvetica,tahoma,verdana,sans-serif;font-size:16px;font-weight:bold;margin-left:10px;">
<tr>
<td><br>Semplice richiamo di un form con dei combo box</td>
</tr>
<tr>
<td style="font-family:helvetica,tahoma,verdana,sans-serif;font-size:12px;font-weight:normal;padding-top:5px;width:600px;">
Scegliere un indice valido e selezionare l'anno da calcolare, il mese iniziale e il numero di mesi.
<br>
<br>
Per eseguire il calcolo premere il pulsante calcola.
</td>
</tr>
</table>
</body>
</html>

MarcoF
05-31-2010, 10:15 AM
I found how to spot the line in error (ext-all-debug.js), so the real line is 9604:


ct.dom.insertBefore(this.el.dom, position);

and the error is "ct is null".

Any idea?

TIA
MarcoF

richard.milone
05-31-2010, 11:14 AM
Hi MarcoF,

When you modified your code from the Simple Form example you dropped the formMain div from the html. Add this code back to the html and it should work:


<tr>
<td><br><div id="formMain"></div></td>
</tr>

For where to place this just refer to the Simple Form example.

MarcoF
05-31-2010, 01:38 PM
Hi Richard, bingo!!

I should admint that the starting point was the dualcomboboxes.html and I really didn't pay attention at the HTML code part.

Now I'll discover why the comboboxes are not loading...

Thanks
MarcoF