First, I am using spring webflow and some spring javascript to make ajax calls easier.
As of right now, I am having ajax make a call into webflow to display the appropriate fragment.
So I am attempting to use Spring.AjaxEventDecoration for my ajax needs for my application. However, I am having some trouble with this method and webflow and from what I can tell, there are very few examples available to work with.
On a side note, I am not using a form or a select box. I thought I would mention this since every example I've found has used a form/form submit with onlick event or select box with onchange event.
Main question: if I have a method in my webflow that has parameters coming from my ajax, can I actually pass in the parameters from ajax to webflow?
Code:
<transition on="disassociateProperty" >
<evaluate expression="dService.disassociateProperty(requestParameters.currentPId ,currentD)" result="flowScope.currentD" />
<render fragments="PList" />
</transition>
So, when I look at the ajax call in firebug, it has the parameter I'm passing in (currentPId) and the correct eventId.
I put a debug point on the first line of the disassociateProperty method and it tells me currentPId is null.
So I would assume requestParameters.currentPId in webflow isn't pulling the currentPId from the ajax call.
Is this expected? Could anyone explain and give an example?
I would appreciate any help provided.
Adam
If you think that the problem comes from ajax call, it would be helpful if you write here the ajax call, so we could check if the call is being done correctly.
You could try to pass the form serialized in the data parameter when doing the ajax call. Also, do not forget to add the ajaxSource parameter in the URL. Hope this help.
HTML example:
<form id="formId" method="post" action="${flowExecutionUrl}&_eventId=disassociateProperty">
<input type="text" id="currentPId" />
</form>
jQuery Example:
$.ajax({
type: "POST",
data: $("#formId").serialize(),
url: $("#formId").attr("action") + "&ajaxSource=true",
...
});