PDA

View Full Version : empty form submission error Failureclient



17 Mar 2009, 4:21 AM
Basic form page and in the action file login.asp just displaying some set of records.
When I submit the form with some data it works.
If I dont submit the form with any data it show error.

Failureclient



Html Code



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->

<script type="text/javascript" src="../../ext-all.js"></script>


<script type="text/javascript">


Ext.onReady(function(){
Ext.QuickTips.init();
var login = new Ext.FormPanel({
labelWidth:80,
frame:true,
title:'Member Login',
width:230,
default:{autoHeight:true},
defaultType:'textfield',

items:[{
fieldLabel:'username',
name:'user',
allowBlank:false,
vtype: 'email',
listeners: {
specialkey: function(f,e){
if (e.getKey() == e.ENTER) {
login.getForm().submit();
}
}
},
},{
fieldLabel:'password',
name:'pass',
inputType:'password',
allowBlank:false,
}],
buttons:[{
text:'Login',
handler:function(){
login.getForm().submit({
method:'POST',
waitTitle:'Connecting',
waitMsg:'Sending data...',
url:'login.asp',
success:function(){
/* url must be changed to another CGI to
validade user's session */
var url = 'default.asp';
window.location = url;
},
failure:function(form, action){
alert("Failure" + action.failureType)
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Oops!', obj.errors.reason);
}else{
Ext.Msg.alert('Oops!', 'Authentication server is unreachable');
}
//login.getForm().reset();

},
});
},
}],
});

//login.render(document.body);
login.render(document.getElementById("LoginForm"));
});

</script>
</head>

<body>
<div id="LoginForm"></div>
</body>

</html>


login.asp code


<!--#include file="JSON_2.0.2.asp"-->
<!--#include file="JSON_UTIL_0.1.1.asp"-->
<%
CONST strConnString = "DSN=extjs;uid=;Pwd=;"

dim sqlQuery

SET objConn1 = server.CreateObject("ADODB.Connection")

'Open Connection
objConn1.Open strConnString
'sqlQuery = "select * from CompanyMaster_Tbl"

'set rsDataAccess = server.createobject("adodb.recordset")

response.write("{""success"":true,""data"":")


QueryToJSON(objConn1, "select * from CompanyMaster_Tbl").Flush

response.write("}")


%>

17 Mar 2009, 5:38 AM
you need to do better at capturing errors in ASP.

17 Mar 2009, 7:00 AM
There is a small mistake in my post

If I submit the form without any data it show error. (Test case)
If i give the user name and password it works fine.

The asp page just returns the rows from the database in this case 2 rows.
in the following format.



{"success":true,"data":[{"CompanyId":1,"CompanyName":"Activecubes Solutions (IT)","CompanyTypeId":"1","Formed":"2007","Revenue":"5 Crores","NoOfEmp":"25","PhoneNo":"42428800","Fax":"42428800","EmailId":null,"Address1":"44, 100 Ft Ring Road,","Address2":"JP Nagar 4th Phase","City":"Bangalore","State":"Karnataka","Country":"India","URL":"www.activecubes.com"},{"CompanyId":2,"CompanyName":"Cubes Solutions (IT)","CompanyTypeId":"2","Formed":"2008","Revenue":"8 Crores","NoOfEmp":"50","PhoneNo":"56427824","Fax":"56427824","EmailId":null,"Address1":"55, 100 radhakrishnan Salai","Address2":"Mylapore","City":"Chennai","State":"TamilNadu","Country":"India","URL":"www.cubes.com"}]}