REMINDER
[TM] Submit forms and calls
-
Hello,
Your Cloud Backend Action in the Page Builder is in 3 steps :
- Before exec
- The Cloud Backend Route
- After exec
It works well but there is 2 "flaws" for me when you use it alongside forms :
In the Before exec, it's possible to cancel the general execution by returning false, but it will cancel the After exec too, and that's sad
It could be used for exemple to keep the whole form checkup with a dummy route, bypass the route call, and call an other route (linked to an other backend).
The general idea is to be able to use all the checkup you have in the forms, but call the route totally differentlyAn other issue is that all the requirements aren't fulfilled, it doesn't call the Before exec function. That's weird to me, it's not really "Before" then.
If I want to use some data and personalize the feedback, it'll not be possible to do it there, it breaks a little the interest of having it.Soooo I don't know if you have a specific way to enjoy your forms with all the errors and stuff without depending of your route calling, right now I use side events in some specific cases and a dummy route for the checkup
Thanks,
Best regards, -
Hey Pierre,
-
The post exec require the server response, so we cannot execute it if the request was cancelled, that's the expected behavior
I suggest that in the case you cancel the request in the PRE event you should call your post action in a block of code rather than defined there in the event handler. This way you can share the same function called from the cancel or post event -
Indeed, the PRE event is executed only if your fields validation are OK, if some fields are not completed this will not trigger the action at all. If you want to trigger the action in all case there is a simple way to do it, disable all validations on the fields so the PRE event will always be triggered. Of course in that case you will have to handle the validation by yourself.
With more power comes more responsibility
-
-
Hello,
You should put your message in Feature requests as it's not a bug it does what it says.Before executing the Cloud Function you can do additional code, if you need to call another backend you can code it inside your before code block. If we managed it (I have no example in mind) it would add a lot of complexity.
Second point : It doesn't call the before exec function, yes because it's not going to trigger the API function as the input validation did not work. If you need another validation process you can still disable the input validation and do your own in the before exec and return false if it's not good.