PDA

View Full Version : Help,combobox cannot be initialized in IE7



odi
14 May 2008, 7:14 PM
the combobox can be initialized with remote data and drop down in firefox3 beta5,
but cannot be initialized in IE7.
how to correct this problem?


the remote data:
{"findAllLanguageResponse":{"return":[{"deleted":false,"id":1,"name":"中文","enumId":1,"value":"zh_CN"},{"deleted":false,"id":2,"name":"英语","enumId":1,"value":"en_US"}]}}

the html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>login</title>
<link rel="stylesheet" type="text/css" href="css/ext-all.css" />
<script type="text/javascript" src="js/ext-base.js"></script>
<script type="text/javascript" src="js/ext-all.js"></script>
<script type="text/javascript" src="js/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL='images/default/s.gif';
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
</script>
<script type="text/javascript">
Ext.onReady(function() {

var languages=new Ext.data.Store({
autoLoad:true,
proxy: new Ext.data.HttpProxy({
method: 'GET',
url: './service/SystemService/findAllLanguage'
}),
reader: new Ext.data.JsonReader(
{root:'findAllLanguageResponse.return',id:'id'},
['value','name','id']
)
});

var loginForm = new Ext.form.FormPanel({
title: 'Welcome Platform Demo',
labelAlign: 'right',
labelWidth: 120,
frame: true,
width: 350,
onSubmit: Ext.emptyFn,
submit: function() {
if(loginForm.form.isValid()){
loginForm.form.getEl().dom.action='/j_spring_security_check';
loginForm.form.getEl().dom.submit();
}
},
items: [
{xtype:'textfield',fieldLabel:'USER ID',id:'j_username',name:'j_username',width:'140',allowBlank:false},
{xtype:'textfield',fieldLabel:'USER PASSWORD',id:'j_password',name:'j_password',inputType:'password',width:'140',allowBlank:false},
{xtype:'combo',fieldLabel:'LANGUAGE',id:'locale',name:'locale',editable:false,store:languages,displayField:'name',valueField:'value',triggerAction: 'all',allowBlank:false}
],
buttons: [
{text:'Login',type:'button',id:'login',handler:function(){loginForm.form.submit()}},
{text:'Reset',type:'reset',id:'clear',handler:function(){loginForm.form.reset()}}
],
method: 'POST'
});
loginForm.render('login-div');
});
</script>
</head>
<body>
<div id="login-div" style="margin: 15% 30% 15% 30%" align="center"/>
</body>
</html>

para
14 May 2008, 9:42 PM
Ok.

1) Put code in CODE tags. It's the # button in the upper right of the text input box.

2) Eliminate extra white spaces. The fact that your code isn't in CODE tags adds extra \n's in places.

3) Use JSLint.com to inspect your code. Especially if it's an IE only problem.

4) Noticed that you are missing ;'s in your two button handlers

buttons: [
{text:'Login',type:'button',id:'login',handler:fun ction(){loginForm.form.submit();}},
{text:'Reset',type:'reset',id:'clear',handler:func tion(){loginForm.form.reset();}}
],

That may solve it, but I doubt it. Repost or edit your first post following those guidelines and someone else may be willing to help.