Hide Form/View Based on Number of Records in a List

I have a page with a List (view_121) and a Form (view_18).

I am wondering if there is a way to hide the form if the list displays any data, i.e. if the list displays “no data” or pulls in no records, the form would display, but if there is at least 1 record displayed in the list, the form would hide.

Any suggestions/thoughts on this?

After some googling, I came up with this Javascript. It is working. If anyone has other suggestions, I’m all ears!

$(document).on(‘knack-scene-render.scene_XX’, function(event, scene) {
if (document.getElementsByClassName(‘kn-list-item-container kn-list-container column is-full’)[0] != null) {
document.getElementsByClassName(‘kn-submit’)[0].style.display = ‘none’;

I inspected the div classes and used the code this way ^

1 Like