PDA

View Full Version : FormPanel submit: please, help



pegaso52it
10 Jul 2009, 2:42 AM
Hi all
I have a FormPanel and I need to handle myself the response after a submit in my own handlers.

My simple code:

...


var vFormPanel = Ext.getCmp('MyFormPanel);

vFormPanel.getForm().submit(
{
url : aUrl,
success : handleSubmittedForm,
failure : handleSubmittedForm
});


....

The url that I submit, al least, invokes a jsp that needs to open a new location

eg.. the jsp

function redirectToReport()
{

<%

String vReqQuery = "ReportManager?" + request.getQueryString();


%>

location.replace('<%= encodeURL(pageContext, vReqQuery ) %>');

}



The problem is that my handler "handleSubmittedForm" is not invoked: I have see using firebug that the reponse is directly managed by Ext classes; that's beacuse inspecting object I have see that in success operation is there "handleRequest" Ext's function and not my own "handleSubmittedForm" function

It seems that Ext object in this case looses the handler that I have setted.


Is there a way to solve this problem?

Thank you very much for your time

jay@moduscreate.com
10 Jul 2009, 6:19 AM
is handleSubmittedForm a reference a method?

jay@moduscreate.com
10 Jul 2009, 6:20 AM
btw, post a simple version of your code in code tags and stop using eclipse's paste option.

pegaso52it
10 Jul 2009, 6:55 AM
Hi Garcia,
thanks for your answer, and excuse me for "past" eclipse option (I'm a new bie :">)

Yes, handleSubmittedForm is the reference function for the response handling,
I show u the code:



function submitForm(aUrl)
{
var vFormPanel = Ext.getCmp('MyFormPanel');
vFormPanel.getForm().submit(
{
url : aUrl,
success : handleSubmittedForm,
failure : handleSubmittedForm
});
}



Here's the handleSubmittedForm:



function handleSubmittedForm(aForm, aAction)
{
alert('here!');
}


This function is not invoked when is redirected the jsp:




<%@ page language="java" contentType="text/html; charset=UTF-8" session="true" isThreadSafe="true" isErrorPage="false" errorPage="/ErrorPage.jsp" %>
<%@ include file="include/ClientDeclarations.inc" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Expires" CONTENT="0">
<MyTag:ExternalCSSLink />
<SCRIPT>
function redirectToReport()
{
<%
String vReqQuery = "ReportManager?" + request.getQueryString();
%>
location.replace('<%= encodeURL(pageContext, vReqQuery ) %>');
}
</SCRIPT>
</HEAD>
<BODY CLASS="GENERAL_BODY Printing_Msg_Body" onload="javascript:redirectToReport();return false;">
<table CLASS="Printing_Msg_Table" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR><TD align= "CENTER" CLASS="Printing_Msg_Style">
<%=getClientProperty(pageContext,"UIStyle.PrintingMessage")%>
</TD></TR></table>
</BODY>
</HTML>


After <code> location.replace </code> is processed, the response is handled by ExtJs's handleRequest function and NOT by my handleSubmittedForm function