I removed the “block” in “reload-block-1a” because all three blocks are the dynamic beta blocks, but I tried it as written above and that didn’t work either. Do you have any ideas of what else I can look for/troubleshoot?
Thank you @matthieu_chateau for your feedback. It was indeed the capital letters in the block name that was causing it. The script now does what it is supposed to - executing an action button on one block causes the other to reload.
However, I get an error message out of corner pop-up:
The second list block that is supposed to reload has conditional visibility on it with the condition checking the value of the field that the first block’s action is updating. That’s the whole point of reloading the second block, so that it can pick up on the value updated by the first block’s action and, consequently, reveal or hide data.
So, there should not be an error reported. How would you recommend I should deal with it?
I have a similar requirement in a different page of my app - the page carrying the user profile update form. I need the page to reload after an update to the form because I have another block above the form with conditional visibility warning the user that all the fields need to be filled out for the app to work correctly. By default, the block’s conditional visibility does not kick in based on the update of the profile form - hence the need to reload the page.
I’ve tried the block above with the following modification, but it doesn’t work. I suspect it’s because it’s a different type of block. The block is called “user-accounts1”.
Softr team, I’ve been thinking there so much interest in the community to have blocks and pages updated based on updates to other blocks. Would it be time for Softr to consider a more of a “native” approach and build in the ability to do these sorts of things by checking some checkboxes in the Studio’s UI, rather than resorting to these short JS injections that vary just so slightly depending on the use case and type of block? Just a thought
I tried the code snippets above but none of them work in this particular use case - a list block with an action button calling an API.
Softr support stated this code won’t work with an action button calling an API. Different code should be used.
Coincidentally, I’ve watched the recent video of JJ and Michael (Sofrr + Xano) and JJ at frame 37:26 gently glides over this nuance - I am just going to refresh the page…
But in any real app, a user cannot be expected to be refreshing pages after clicking buttons.
For my use case, if anyone can recommend the variation of the code I can insert to make Softr refresh the block after the action button’s api call, that would be great.
More broadly speaking, if Softr could come up with ways to auto-refresh blocks after various action button types and do it more natively, without code injections, that would be great!
Hello Community. Softr support pointed me to the documentation. The code that needs to be injected in the header is indeed documented. It can be found here:
Thanks Softr Support team!
PS
It’s not the most sophisticated way of handling API responses. In other words, it doesn’t really “wait” for the API to respond and does not parse the response. It just waits an X number of seconds and reloads the block. Not ideal, but does the job, if you are willing to wait long enough to have whatever workflow you have behind your webhook do its job and do in on time and before the block gets reloaded…
I’m new to softr, and am trying to use the aforementioned code to help update my list block after I push the Call API button which I named “Like”. The dynamic list block name is “availablereferrals”.
I posted this code into the header, but it is not refreshing the list. Can someone help?
Good day all,
Can anyone help update my pages so they refresh please like you discussed in the thread? My use case is not shown and I urgently need it done please. Use case is as follows:
I have a page with 2 blocks:
BLOCK-ID 1 = custom-code3 (which is a simple form using fillout.com and 1 button to submit the form. When submitted Fillout generates a “SUCCESS” page. When this happens I need to refresh the entire page OR when this happens I need to refresh only the second block on the page which is:
BLOCK-ID 2 = table1, which shows the Airtable record that is being updated (statuses update and show on the block).
That’s all.
If I submit and refresh manually, the status can be seen updating correctly, I simply want the refreshes to be automatic, maybe every 1 second or so.
Hope you can help. I am on the Softr Business plan, so I have access to most features I think.
Listening for events on your fillout embeded form and then fire events accordingly on your softr page has been very elusive due to browser cross origin policies, although it is for a good reason.
But I guess there has to be alternatives to explore.