vendredi 26 juin 2020

Enabling or disbaling a field according to value of Yes/No (checkbox) field in sharepoint

I have created a list in sharepoint of the form below: enter image description here

I want to hide the fields 'Tool' and 'Responsible' when the checkbox for 'RCA Required' is unchecked (or No), otherwise the fields such as 'Tool' and 'Responsible' should be shown. I have tried the following code in script editor of sharepoint:

<script src="https://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("select[title='RCA Required']").click(function() {
if ($('input[title="RCA Required"]').is(':checked'))
{
$('nobr:contains("Tool")').closest('tr').show();
$('nobr:contains("Responsible")').closest('tr').show();
}
else
{
$('nobr:contains("Tool")').closest('tr').hide();
$('nobr:contains("Responsible")').closest('tr').hide();
}
});
});
</script> 



Aucun commentaire:

Enregistrer un commentaire