I have a small "sign here" form on a scene. What I would like to do is make it so that the input field, where someone would enter there name, becomes disabled if it has a value (it has already been signed). Then I would like to remove the "Submit" button, to prevent changes in auto-updated fields (date submitted, etc.)
I have this:
$(document).on('knack-view-render.view_1256', function(field) {
if ($('input#field_183').text() !== null) {
$('#view_1256 #field_183').attr('disabled', 'disabled'); // disable input field
$("#view_1256 .kn-submit input[type=submit]").each(function() { $(this).css("display", "none"); }); // hide submit button
}; // end if
});
but it disables the field and hides the button regardless of whether or not the field is null or has a value. I need it to work only if the field is not null. Could someone tell me what I am doing wrong?