finco
5 Apr 2007, 8:17 PM
I'm just started to play with extjs. I've put my code below and have three questions:
1. How do I get to the valueField of the combobox. I only seem to get the displayValue.
2. In the function DoSearch, the commented line does not work. I get an undefined error. Can someone please tell me what I'm doing wrong.
3. How do I add a submit button to the dorm?
Thanks in advance for your help.
<html>
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="../../yui/yui-ext/resources/css/ext-all.css"/>
<!-- LIBS -->
<script type="text/javascript" src="../../yui/yui-ext/yui-utilities.js"></script>
<script type="text/javascript" src="../../yui/yui-ext/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../../yui/yui-ext/ext-all.js"></script>
<script language="javascript" src="ftt.js"></script>
<!-- ENDLIBS -->
<link type="text/css" rel="stylesheet" href="proximity.css">
<script type="text/javascript">
// simple array store
Ext.onReady(function(){
// simple array store
var store = new Ext.data.SimpleStore({
fields: ['fttcode', 'fttdesc'],
data : Ext.data.ftt // from states.js
});
var combo = new Ext.form.ComboBox({
store: store,
displayField:'fttdesc',
valueField:'fttcode',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a category...',
selectOnFocus:true
});
combo.applyTo('ftt');
var btnSearch = new Ext.Button('btn1',
{text: 'Search'
});
Ext.get('btn1').on('click', function(){
DoSearch();
});
});
function DoSearch() {
// var ftt = Ext.get("ftt").value
var ftt=document.getElementById("ftt").value;
alert(ftt);
}
</script>
</head>
<body>
<form method="post" id="frmParameters" name="frmParameters">
<input type="text" id="ftt" name="ftt" size="35">
<div id="btn1"></div>
</form>
</body>
</html>
1. How do I get to the valueField of the combobox. I only seem to get the displayValue.
2. In the function DoSearch, the commented line does not work. I get an undefined error. Can someone please tell me what I'm doing wrong.
3. How do I add a submit button to the dorm?
Thanks in advance for your help.
<html>
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="../../yui/yui-ext/resources/css/ext-all.css"/>
<!-- LIBS -->
<script type="text/javascript" src="../../yui/yui-ext/yui-utilities.js"></script>
<script type="text/javascript" src="../../yui/yui-ext/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../../yui/yui-ext/ext-all.js"></script>
<script language="javascript" src="ftt.js"></script>
<!-- ENDLIBS -->
<link type="text/css" rel="stylesheet" href="proximity.css">
<script type="text/javascript">
// simple array store
Ext.onReady(function(){
// simple array store
var store = new Ext.data.SimpleStore({
fields: ['fttcode', 'fttdesc'],
data : Ext.data.ftt // from states.js
});
var combo = new Ext.form.ComboBox({
store: store,
displayField:'fttdesc',
valueField:'fttcode',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a category...',
selectOnFocus:true
});
combo.applyTo('ftt');
var btnSearch = new Ext.Button('btn1',
{text: 'Search'
});
Ext.get('btn1').on('click', function(){
DoSearch();
});
});
function DoSearch() {
// var ftt = Ext.get("ftt").value
var ftt=document.getElementById("ftt").value;
alert(ftt);
}
</script>
</head>
<body>
<form method="post" id="frmParameters" name="frmParameters">
<input type="text" id="ftt" name="ftt" size="35">
<div id="btn1"></div>
</form>
</body>
</html>