PDA

View Full Version : POST using BasicForm



shico
28 Jan 2010, 10:04 AM
Hi all,

I’ve just started to play with ExtJS and experiencing problem posting a form on a server. The question is must be very simple and although I found a lot of similar questions on the forum, I still cannot make POST using BasicForm. I’m using ASP.NET as a server, and if I’m setting ‘method’ property of BasicForm to “GET” then I’m able to get entered values in “context.Request.QueryString” on the server. It’s fine. But when I’m trying to use POST or even to put a div with a BasicForm inside DOM form tag, the BasicForm even rendered improperly. Basically I want to read data from context.Request.Form collection on the server. Is it even possible? Here is my client-side code:



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="ExtJSTest._Default" %>
<html>
<head runat="server">
<title>ExtJS Test DashBoard</title>
<link rel="stylesheet" type="text/css" href="./Scripts/extJS/resources/css/ext-all.css" />

<script type="text/javascript" src="./Scripts/extJS/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="./Scripts/extJS/ext-all.js"></script>
<script type="text/javascript" src="./Scripts/DetailsForm.js"></script>

<script type="text/javascript" language="javascript">

Ext.onReady(function(){
var simple = new Ext.FormPanel({
labelWidth: 75,
url:'SaveData.ashx',
method:'Get',
frame:true,
title: 'Simple Form',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank:false
},{
fieldLabel: 'Last Name',
name: 'last'
}],
buttons: [{
text: 'Save',
handler: function(){simple.getForm().submit();}
},{
text: 'Cancel',
handler: function(){simple.getForm().reset();}
}]
});
simple.render(Ext.get('detailsForm'));


});


</script>
</head>
<body>
<%-- <div id="detailsForm" style="width:600;height:500;">
</div> --%> <%-- <---- This is Fine--%>
<form id="frm_Details">
<div id="detailsForm" style="width:600;height:500;">
</div> <%--Wrong render if this div is here--%>
</form>
</body>
</html>



Where is the problem here? :-? Thank you in advance!