Wednesday 6 August 2014

Show/Hide #SharePoint columns in a List based on selected values in a drop-down list:


<script language="javascript" type="text/javascript">
$(document).ready(function() {
    showhide();
   $("select[title='FieldName']").change(function() { showhide(); });

});

function showhide()
{
   alert("inside function");// just to debug script , remove while move in production
    var thisVal =  $("select[title='FieldName']").val();
    alert(thisVal);// just to debug script , remove while move in production
    if (thisVal=="Somevalue")// your condition
    {
    alert("show all");// just to debug script , remove while move in production
     $('nobr:contains("FieldName")').closest('tr').show();


}
else
      {
     alert("inside else");// just to debug script , remove while move in production
     $('nobr:contains("FieldName")').closest('tr').hide();

}
</script>

No comments:

Post a Comment

Hide Time from events in Calendar list or webpart Use below code in content edit webpart or by editing list page in SharePoint designer ...