PDA

View Full Version : form submit error



yesky2006
22 May 2007, 4:56 AM
I wrote 2 simple JSP pages and got submit error.
when I click login button on test1.jsp, IE tells syntax error
"Line:36
Char:1477
Code:0"

What's wrong with it?

test1.jsp:

<html>
<head>

<link rel="stylesheet" type="text/css" href="/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="/ext/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="/ext/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="/ext/ext-all.js"></script>



</head>
<body>
<div id='LoginDlg'/>
<script language="javascript">
Ext.onReady(function(){

debugger;

Ext.QuickTips.init();

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

/*
* ================ Simple form =======================
*/
var simple = new Ext.form.Form({
labelWidth: 75
});
simple.add(
new Ext.form.TextField({
fieldLabel: 'login name',
name: 'usr',
width:175,
allowBlank:false
}),

new Ext.form.TextField({
fieldLabel: 'password',
name: 'pwd',
inputType:'password',
width:175
})

);

var btn = simple.addButton(
'login');
btn.on('click', function(){
simple.submit({url:'test2.jsp', method:'get'});
}
);
simple.addButton('submit');

simple.render('LoginDlg');
});
</script>
</body>
</html>

test2.jsp:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ask place</title>
</head>
<body>
<%
String username= request.getParameter("usr");
session.setAttribute("usr", username);
%>
hi,
<%=username %>
</body>
</html>

tryanDLS
22 May 2007, 7:47 AM
Please post your code in 'code' tags so people can read it. Did you look for mismatched parens or braces?

tpattison
22 May 2007, 8:10 AM
After a quick scan I see you are calling the following in your code:


<script language="javascript">
Ext.onReady(function(){

debugger;

Ext.QuickTips.init();


What is this calling or referencing? I do not see the ext debugger script included in your JSP page.

Also test it in Firefox with Firebug to debug the application.

prophet
22 May 2007, 8:37 AM
"debugger", for IE at least, will prompt the developer to open the debugger and jump into the code. I think it's unrelated to extjs.