Hi All,
Don't know if anyone can help me.
I have a serverconnect form that all runs and completes correctly (200 response) BUT,
No matter what I do using dmx-on:done will not evaluate a condition correctly that relies on a value output from that forms server connect script (or other server connect dynamic event).
I.e. form is submitted, events runs as they should, value is output and visible correctly in the browser but an inline flow on dmx-on:done will not evaluate a condition using the value output (doesn't matter whether checking is set or == operator).
Any advice would be great, I've tried adding a long wait, different server connect dynamic events (that's why I've used dmx-on:done - everything should be complete and returned before evaluating?). It always evaluates the condition as else not if regardless of the output.
Help appreciated as always
Can you try simply changing it to dmx-on:success
to identify if it is the done method or your expression? Sharing the code produced for the whole dmx-on:done property (and, ideally, how it looks in the flow designer) would be useful to us when helping you
I have tried it with on success (that's where I started/ wanted it to be but switched it to done to make sure that the script had fully finished execution).
It seems to make no difference?
As I said I've tried the condition for: is set or == operator and always evaluates to false regardless of the value returned by the form script completing.
Makes me think its not picking up the value returned by the script, but it is visible and returned correctly in browser?
Not quite sure what to try next
It's hard to answer your question without seeing the code on your page.
Please provide the code of your form where the dynamic event is used.
Try a page flow, seem to recall some difference (synchronous/synchronous triggered from the event.
May be a timing issue.
Thanks just tried that now, and had the same result.
This is my page flow (just some nested conditions)
<script is="dmx-flow" id="sent_done" type="text/dmx-flow">[
{
condition: {
outputType: "boolean",
if: "{{sc_email.data.not_signed}}",
then: {
steps: {
bootbox.alert: {
message: "You Have Been Signed Out - Please Sign Out And Back In"
}
}
},
else: {
steps: {
condition: {
outputType: "boolean",
if: "{{sc_email.data.send_error}}",
then: {
steps: {
bootbox.alert: {
outputType: "boolean",
message: "There Was An Error Sending Your Email - Please Check Email Addresses ",
title: "Error",
buttons: {
ok: {label: "Clsoe"}
}
}
}
},
else: {
steps: {
condition: {
outputType: "boolean",
if: "{{sc_email.data.complete==1}}",
then: {
steps: {
runJS: {outputType: "text", function: "closetab"}
}
},
else: {
steps: {
bootbox.alert: {
message: "Confusion?",
title: "{{'Error = '+sc_email.data.complete}}",
buttons: {
ok: {label: "Close"}
}
}
}
}
}
}
}
}
}
}
}
}
]</script>
On doing some testing - Form script runs to completion - the output results are visible in browser but none of the data returned seems to be accessible to my page?
If I try to bind any of the data returned using:
{{sc_form.data.bound_data}}
I get nothing? Am I trying to access these bindings incorrectly - but they are accessible in the data picker?
Thanks
what is sc_form
? Is it your form or some server action?
You can inspect what data is returned from the form after success/done event by opening the browser console, enter dmx.app.data
and inspect the component and the data under it. Please post a screenshot of it.
sc_email is the server connect form.
the data is returning null in dmx.app.data, but the network panel is showing the correct data returning from the form result?
I can use the picker to bind to the data in the form:
And they are being returned correctly in the network panel:
Am I wrong in thinking this is where to bind them too?
Is this after the form was submitted? You should run the dmx.app.data after the form was submitted.
It was after the form had been sent.....
It has just started working as expected after moving it outside of the nested condition?
I've rebuilt the page flow and is now working as expected so all good!
Many thanks
Then the expression is wrong, if it’s inside a condition, the condition should also be included in the expression: {{condition_name.form_name.data…}}
Sorry, the nested conditions inside the page flow after the form has submitted, not the form itself.
Seems to be working now though
Thanks