Hello,
I have a plugin that has an HTML form (on a velocity template) that submits to an xwork action for the plugin.
I tried to get the form to post and have the Confluence page render with the macro in context on the page with the results of the action processed but I can’t get that to work.
I’m using an absolute URL for the form action and that opens a new tab/page and renders the results of the action (via the velocity template) out of context from the Confluence page the macro lives on:
<form id="foo_form" action="$req.contextPath/plugins/foo/process-form.action" method="POST" name="fooForm">
I suppose I could implement REST endpoints to do what I need instead of the xwork action but I’m refactoring an existing plugin that used to post a form back to the enclosing page and I want to take the simplest path for now.
The form submittal back to the page (using the vewpage.action of Confluence) worked fine in old versions of Confluence but is a HTTP 405 in Confluence 7+ (probably a security change).
The old form was like this:
<form id="foo_form" action="${req.contextPath}/pages/viewpage.action" method="POST" name="fooForm">
<input type="hidden" name="pageId" value="${pageId}"/>
Thanks.