Hi,
You might remember me from such post as Dynamic Link Labelling
or Getting AjaxURL tags working.
I'm still having a problem of sorts getting custom units working correctly with the AjaxURL tag ... specifically with getting parameters from a html form submitted using the AjaxURL tag.
I have a custom display unit that contains (among other things) a dynamically labelled button. Clicking this button needs to send some input parameters from the page (both hidden and from UI controls) to another custom unit that will perform some processing on the values.
An example of the custom unit template is shown below:
<form NAME="contribute" ACTION="" METHOD="GET">
<tr class="row">
<td>
<input type="hidden" name="<c:out value="${<wr:UnitId/>.signOid}"/>positionIndex" id="positionIndex" value="<c:out value="${<wr:UnitId/>.positionIndex}"/>" />
<input type="hidden" name="<c:out value="${<wr:UnitId/>.signOid}"/>option" id="option" value="<c:out value="${<wr:UnitId/>.singleOptionOid}"/>" />
<input title="<c:out value="${<wr:UnitId/>.actuatorLabel}"/>" onclick="<wr:AjaxURL context="link" type="button"/>" type="submit" id="button:<wr:Id context="link"/>" name="button:<wr:Id context="link"/>" value="<c:out value="${<wr:UnitId/>.actuatorLabel}"/>"/>
</td>
</tr>
</form>
I want to be able to get the values of the hidden input fields (and in a different example the selected value of a drop-list UI control).
If I don't use the onclick AjaxURL tag, the http GET request sends values in the request parameter list. The values can be obtained in the target link unit using the following in the target custom unit's execute method:
HttpServletRequest request = (HttpServletRequest)operationContext.get(RTXConstants.HTTP_SERVLET_REQUEST_KEY);
optionId = request.getParameter(signId+"option");
position = request.getParameter(signOid+"positionIndex");
However not using an Ajax request causes a whole page refresh to happen when really an AJAX request was required so that the current page context (and popup page) do not lose context.
The AjaxUrl link tag works exactly as I want, and fires the target link, but no input values come through in the request.
Can someone help with how to pass the parameters as part of the AJAX link tag please?