You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/08/05 14:37:17 UTC
DO NOT REPLY [Bug 22132] New: -
Cannot use redirect-to after submit jxform
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22132>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22132
Cannot use redirect-to after submit jxform
Summary: Cannot use redirect-to after submit jxform
Product: Cocoon 2
Version: 2.1m2
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: sitemap components
AssignedTo: dev@cocoon.apache.org
ReportedBy: chris.clark@teranet.ca
If you include a redirect-to directove in yuor sitemap in a <map:match> that
catches the submission of a JXForm, the redirect-to fails and you're left with
a blank page. This was discovered while trying to make a login JXForm and
using the Cocoon authorization but was confirmed later with a standalone form.
Source code for the problem. Note, "as is", this code works. However, if you
replace any of the generate/serialize inthe selector with a redirect-to, it
will fail.
Here's the sitemap that exhibits the problem:
---------------------------------------------
<!-- Pattern for initial/continuation form requests -->
<map:match pattern="doform-*-*">
<map:call function="jxForm">
<map:parameter name="function" value="{2}"/>
<map:parameter name="id" value="form-{1}-{2}"/>
<map:parameter name="validator-schema-ns"
value="http://www.ascc.net/xml/schematron"/>
<map:parameter name="validator-schema" value="schematron/rules-{1}-
{2}.xml"/>
<map:parameter name="scope" value="request"/>
</map:call>
</map:match>
<!-- Pattern for form rendering - called from jscript sendView() -->
<map:match pattern="form-*">
<map:generate type="jxforms" src="content/forms/form-{1}.xml" label="xml"/>
<map:transform type="xalan" src="transforms/jxforms-default.xsl"
label="debug" />
<map:transform type="xalan" src="transforms/jxforms2html.xsl"
label="debug2" />
<map:serialize type="html" />
</map:match>
<!-- Pattern for handling XSLT generated output -->
<!-- **** Using a <map:redirect-to> in ANY map:when will FAIL **** -->
<map:match pattern="output-*">
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{1}"/>
<!-- case: query results for login activity -->
<map:when test="admin-login">
<map:generate src="authorization/elrsaudit.xml"/>
<map:transform src="transforms/admin-queryresults.xsl" label="debug" >
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:serialize/>
</map:when>
<!-- case: query results for receipt activity -->
<map:when test="admin-receipt">
<map:generate src="content/xml/misc-impl.xml"/>
<map:serialize/>
</map:when>
<!-- case: query results for any other activity -->
<map:otherwise>
<map:generate src="content/xml/misc-impl.xml"/>
<map:serialize/>
</map:otherwise>
</map:select>
</map:match>
Here's the javascript used:
---------------------------
cocoon.load("resource://org/apache/cocoon/components/jxforms/flow/jxForm.js");
function queryaudit(form) {
var searchCriteria = {
startDate: "",
endDate: "",
actType: "",
userName: "",
groupName: "",
docNum: "",
pin: ""
}
form.setModel(searchCriteria);
form.sendView("form-admin-queryfilter");
form.finish("output-admin-" + searchCriteria.actType)
}
Here's the form definition:
---------------------------
<?xml version="1.0"?>
<html xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
<head><title>Test</title></head>
<body>
<p>
<!-- Specifics for this page -->
This page will allow users with sufficient privledges to enter criteria for a
search of the audit records.
</p>
<xf:form id="form-admin-queryaudit" view="form-admin-queryfilter"
action="doform-auth-queryaudit" method="GET">
<xf:label>Query Parameters</xf:label>
<error>
<xf:violations/>
</error>
<xf:input ref="startDate">
<xf:label>Start Date (req'd)</xf:label>
<xf:hint>Enter an inclusive start date (MM/DD/YYYY)</xf:hint>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="endDate">
<xf:label>End Date (req'd)</xf:label>
<xf:hint>Enter an inclusive end data (MM/DD/YYYY)</xf:hint>
<xf:violations class="error"/>
</xf:input>
<xf:select1 ref="actType">
<xf:label>Activity Type</xf:label>
<xf:item>
<xf:label>Login</xf:label>
<xf:value>login</xf:value>
</xf:item>
<xf:item>
<xf:label>Document Receipt</xf:label>
<xf:value>receipt</xf:value>
</xf:item>
</xf:select1>
<xf:input ref="userName">
<xf:label>User Name</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="groupName">
<xf:label>Group Name</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="docNum">
<xf:label>Document Number</xf:label>
<xf:hint>Format is: XX######</xf:hint>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="pin">
<xf:label>PIN</xf:label>
<xf:hint>Format is: #####-####</xf:hint>
<xf:violations class="error"/>
</xf:input>
<xf:submit id="query" phase="checkfilter" continuation="forward"
class="button">
<xf:label>Query</xf:label>
<xf:hint>Run Query</xf:hint>
</xf:submit>
</xf:form>
</body>
</html>