0
votes

I have created columns for a list in SharePoint. Some of the columns are choice columns. When I create a new item, all the columns are visible to be populated with data about the new item.

I need to be able to show/hide certain fields based on the option chosen in one of the choice columns. I have done some research about this but it seems that it is only possible to do this using code. Unfortunately, I don't have access to the code of our SharePoint site or to the SharePoint Designer feature so I was wondering if there is a way to do this using a formula in a calculated column?

Thank you.

Cyrille

1

1 Answers

0
votes

To add the JavaScript code to newform page, we don't need using SharePoint designer. We can edit the page in UI and add script editor web part to the page, then add JavaScript code to achieve it. Example code.

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('nobr:contains("Field1")').closest('tr').hide();  
        //Show/hide columns based on Drop Down Selection 
        $("select[title='ChoiceField']").change(function() {
        if ($(this).val() != "Other"){
            $('nobr:contains("Field1")').closest('tr').hide();
        }else{
            $('nobr:contains("Field1")').closest('tr').show();
        }
    });
});
</script>

Refer to: Show / Hide fields based on choice field selection using JQuery in SharePoint

If you don't want to use the code, please use InfoPath to achieve it. Check this:How to Hide a field on the List form based on another field