Server Connect form not receiving an output value

First off, my Wappler user self esteem is taking a hit this week having to ask for help several times haha. That said, perhaps I’m missing little things because I have a deadline to meet which is this Thurs. and I’m rushing. I’m banging my head against the wall on something that should be quite simple that I’ve done a 1000 times in Wappler. Not sure if it’s a bug or not so don’t want to do a bug report if it’s just me missing something.

I have a simple delete form, everything works fine, except checking for a value that I set to ‘success’ or an error message. It always fails as if the value is not being output, yet I can see it in the console, but the form success event doesn’t appear to see it. I have tried formDeleteApp.data.deleteResponse==‘success’, (which is the known way) and even formDeleteApp.deleteResponse==‘success’, data.deleteResponse==‘success’ and deleteResponse==‘success’ for the hell of it. The form never sees the value.

FORM CODE: (sorry for the screenshot but I tried using indented and surrounding in back ticks but nothing shows)

The server connect does output the value

But the success event on the form doesn’t read it for some reason. The condition fails and as you can see, the alert message is blank.

Server Connect:

Thanks in advance,
Twitch

Is the output flag turned on for the queryIteminOrder query?

Thanks for the reply, @baub. I’m not outputing that query and it shouldn’t matter because the value I’'m checking for is the deleteResponse which is correctly being output on success or failure, but the form never seems to read it. I’ve never had this issue before.

Why not use response steps for this? Return 200 in the THEN step after the delete step and return 409 in the Else step.
Then check these statuses on the front end.

Also posting code in the community is better than screenshots. It’s done this way:

```
<form code goes here ... 
```
1 Like

I tried posting the form code inside the three back ticks but when I did, the form disappeared. The reason I’m using set values is because I reuse the delete form in partials and the error message may be different depending on the delete server connect file that was used. In this case, I do a check that a particular beverage is not on any customers’ order before allowing deletion. In another the message may return something different to the error alert text. I even tried checking for the formDeleteApp.data.delete.affected 0 or 1 and it wouldn’t see that value either. It always returned false even when the delete query ran successfully and returned a 1

<form id="formDeleteApp" method="post" is="dmx-serverconnect-form" action="/api/archray_items/delete" dmx-on:success="run({condition:{outputType:'boolean',if:`formDeleteApp.data.deleteResponse==\'success\'`,then:{steps:[{condition:{outputType:'boolean',if:`varAppIdParamValue.value`,then:{steps:{run:{outputType:'text',action:`qmGlobal.remove(varAppIdParam.value)`}}}}},{condition:{outputType:'boolean',if:`(!iteratorApp.has.prev &amp;&amp; scApp.data.qData.offset == scApp.data.qData.page.offset.first)`,then:{steps:{condition:{outputType:'boolean',if:`!iteratorApp.has.next`,then:{steps:{run:{outputType:'text',action:`flowAppHideDetail.run()`}}}}}},else:{steps:{run:{outputType:'text',action:`flowAppPrevButton.run()`}}}}},{run:{outputType:'text',action:`notifiesCrud.success(varAppSingularText.value+\' deleted!\');scApp.load({});scAppDropdown.load({},true)`}}]},else:{steps:{condition:{outputType:'boolean',if:`varAppDetailType.value.contains(\'modal\')`,then:{steps:{run:{outputType:'text',action:`modalDetailApp.conditionalAppModalDetailContent.alertApp.setType(\'danger\');modalDetailApp.conditionalAppModalDetailContent.alertApp.setTextContent(formDeleteApp.data.deleteResponse);modalDetailApp.conditionalAppModalDetailContent.alertApp.show()`}}},else:{steps:{run:{outputType:'text',action:`alertApp.setType(\'danger\');alertApp.setTextContent(formDeleteApp.data.deleteResponse);alertApp.show()`}}}}}}}})" dmx-on:submit.prevent="run([{run:{outputType:'text',action:`flowResetAppDetailForm.run()`}},{'bootbox.confirm':{name:'confirmDeleteApp',message:`\'Are you sure you want to delete \'+varAppSingularText.value.lowercase()+\'?\'`,title:'Delete ',buttons:{confirm:{label:'Yes, Delete',className:'btn-danger'},cancel:{label:'Cancel'}},then:{steps:{run:{outputType:'text',action:`formDeleteApp.submit(true)`}}},else:{steps:{run:{outputType:'text',action:`formDeleteApp.reset(true)`}}}}}])">
    <input id="inpAppDeleteId" name="id" class="form-control form-control-sm" dmx-bind:value="varAppDetailFormData.value.id" type="hidden">
</form>

Ok I see why the form code didn’t work before, like in your example, I needed to have a return after the first 3 ticks.

Sorry, about that.

Can you try calling just a simple alert on success and see if it displays the value?
Also, i’d recommend not using all these complex inline flows on the form element but instead define page flow and call it on success.
Inline flows are useful for really simple actions, not such complex ones.

Thanks again for the reply, Teodor. I removed a lot of the conditions in the success event and I THINK something changed. Not sure yet. I’ll do some experimenting and let you know.

I believe I figured out the culprit. The on done form reset event triggering before the on success event?

dmx-on:done="formDeleteApp.reset(true)"

I removed that and everything works as expected. I’ll just reset it on cancel of the confirm which I also had already. Not sure why I put it on the done event. :man_facepalming:

1 Like