Workflow : Hide update form at the end of a procedure based on detail view value

If you are using within a workflow pages that can be displayed by multiple users.

In a form to update a task for example, you can of course play with the display rules to hide fields based on record value to prevent the user to update the record by mistake.

However the submit button is still there and if you are using buit-in knack submit rule to automatically update date of submission or the logged-in user, then a click on the submit button will change the update date/time as well as the user and your DB will store wrong data.

The target is then to prevent the user to be in a position to click a submit button for records already at the end of a workflow procedure and will as a consequence prevent the submit rule to be triggered.

Assuming your task update page (scene_1) contains 1 detail view (view_1) showing information + task status (field_1) and a form (view_2) to update the task, you want to hide the form if the procedure status is "End of procedure" :

/* HIDE FORM BASED ON DETAIL VALUE */

$(document).on(‘knack-scene-render.scene_1’, function(page) {

if ($(’#view_1 > div.kn-details-column.first > div.kn-details-group.column-3 > div:nth-child(2) > table > tbody > tr.field_1 > span’).text() == “End of procedure”) {
$(’#view_2’).hide()
}
});

You will have to adapt the path to field_1> span.

Im looking for something like this, but not sure if it's the same.

I need a form to not show up anymore after it has been submitted on a page. I guess the js should check if a value in a certain field exists and not show that (part of) the form anymore.

It looks like this is the same, but not sure. Also, what does .text mean? If this field is a checkbox, would that still work?