Customise or hide error message on list details block; and a couple of other suggestions

Hello Softr team,

A few small-ish (I hope) suggestions, from myself and my collaborator:

On list details blocks, would it be possible to customise and/or hide the error message (“Requested record was not found. Please contact the site administrator.”) if a record is not found?

Use case: I have a block, with just an action button in it (to register for a course), I am trying to deliberately hide if a user has already registered for the course. I’m achieving this by applying a conditional filter to the block (“Attendees” is none of “Logged in user’s user” - i.e. their name isn’t already in the linked record field; if it is, then they’ve already registered and can’t see the button.)

It seems I’ve got the functionality I was intending working perfectly, but then the error message appears, even though from my perspective, there is no error - but seeing this would confuse the user!

And a couple of smaller suggestions/fixes:

  • Unless I’m missing something, it doesn’t appear to be possible to edit the colour, border, roundness etc. of the “Comment” button itself on the newly updated comments block? (Previously I could change the colour at least, but not the other aspects?)

  • Can we get an option on list blocks search bars somewhere to display the number of returned records in a search?

  • When user’s edit records, lists of linked records (in this case, names of my users), don’t display all the names when you open the list - but if you type to search, they appear in a text match. Just seems like a visual error?

Many thanks for your consideration :slight_smile:

Matt

Hello,

Thank you so much for taking time and adding these details.

I will add both improvements and suggestions to our List of Features.

I had the same issue with the first error message you mentioned…

The Softr.io team helped me with a code that hides that message, you just have to change the name for the block you want to hide

I hope it helps you…

1 Like
<script>
    window.addEventListener('get-record-list-details8', (e) => {
        if (!e.detail.id) {
            document.getElementById('list-details8').classList.add('d-none');
        }
    });
</script>
1 Like

:wink:

Interesting, thank you! But I can’t seem to get it to work?

I do have another code snippet I’m already using in the header of the same page. They are contained within separate tags; might this be an issue? I am not a programmer whatsoever, so I couldn’t say if one is blocking the other…

In the example code above, you’ll need to change list-details8 to the id of the list details block on your page. Did you already try that?

Yes, renamed the block and the equivalent bit in the code to match. So they combined bits of code in my header look like this:

<script>
    document.addEventListener("DOMContentLoaded", function () {
        var exitCondition = setInterval(function() {
            $('a').each(function() {
                if($(this).attr('href') && $(this).attr('href').includes('{LOGGED_IN_USER:ID}')) {
                    const airtable_record_id =  window['logged_in_user']['airtable_record_id'];
                    const url = $(this).attr('href').replace('{LOGGED_IN_USER:ID}', airtable_record_id);
                    $(this).attr('href', url);
                }
            });
        }, 600);
    });
</script>

<script>
    window.addEventListener('get-record-list-details2', (e) => {
        if (!e.detail.id) {
            document.getElementById('list-details2').classList.add('d-none');
        }
    });
</script>

Ok, never mind - got it to work! Apparently it didn’t like my custom named or renamed blocks for some reason - so I duplicated the block in question and used the new id in the code, and voila!

@Nocodeboy @dcoletta many thanks both for your help :slight_smile:

Matt

2 Likes

Anyone have a snippet to hide the list results when search bar is null ? I don’t want to show anything in a list until the user has searched. - TIA

2 Likes

Hey where should I put the code to use it?

Hey @LuisaMarie,

Please add it to Page Settings > Custom code > Header area.

Save the changes and publish the app.

1 Like

Thanks!